From 9baf4c4a45d0da6735272a0388ef7e7a18c37720 Mon Sep 17 00:00:00 2001 From: dekvall Date: Sat, 14 Nov 2020 17:55:48 +0100 Subject: [PATCH 001/173] widgetid: correct quest completed text --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 226e646688..613beda0ca 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -641,7 +641,7 @@ public class WidgetID static class QuestCompleted { - static final int NAME_TEXT = 2; + static final int NAME_TEXT = 4; } static class Raids From 6f60750c313d586b5130717c7b9b8dc2383aa319 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 20 Nov 2020 19:44:17 -0500 Subject: [PATCH 002/173] combat level: show next levels needed even past 99 In some cases, it is not possible to get a combat level solely from leveling any one stat. If this happened previously the overlay would show an empty tooltip due to the levels required all being >99. This just shows the levels required even if it surpasses 99. --- .../combatlevel/CombatLevelOverlay.java | 14 ++-- .../combatlevel/CombatLevelOverlayTest.java | 79 +++++++++++++++++++ 2 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlayTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java index 01586b9e2e..0eabb100a1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.combatlevel; +import com.google.common.annotations.VisibleForTesting; import net.runelite.api.Client; import net.runelite.api.Experience; import net.runelite.api.Skill; @@ -81,7 +82,8 @@ class CombatLevelOverlay extends Overlay return null; } - private String getLevelsUntilTooltip() + @VisibleForTesting + String getLevelsUntilTooltip() { // grab combat skills from player int attackLevel = client.getRealSkillLevel(Skill.ATTACK); @@ -108,23 +110,23 @@ class CombatLevelOverlay extends Overlay StringBuilder sb = new StringBuilder(); sb.append(ColorUtil.wrapWithColorTag("Next combat level:
", COMBAT_LEVEL_COLOUR)); - if ((attackLevel + strengthLevel + meleeNeed) <= Experience.MAX_REAL_LEVEL * 2) + if ((attackLevel + strengthLevel) < Experience.MAX_REAL_LEVEL * 2) { sb.append(meleeNeed).append(" Attack/Strength
"); } - if ((hitpointsLevel + defenceLevel + hpDefNeed) <= Experience.MAX_REAL_LEVEL * 2) + if ((hitpointsLevel + defenceLevel) < Experience.MAX_REAL_LEVEL * 2) { sb.append(hpDefNeed).append(" Defence/Hitpoints
"); } - if ((rangeLevel + rangeNeed) <= Experience.MAX_REAL_LEVEL) + if (rangeLevel < Experience.MAX_REAL_LEVEL) { sb.append(rangeNeed).append(" Ranged
"); } - if ((magicLevel + magicNeed) <= Experience.MAX_REAL_LEVEL) + if (magicLevel < Experience.MAX_REAL_LEVEL) { sb.append(magicNeed).append(" Magic
"); } - if ((prayerLevel + prayerNeed) <= Experience.MAX_REAL_LEVEL) + if (prayerLevel < Experience.MAX_REAL_LEVEL) { sb.append(prayerNeed).append(" Prayer"); } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlayTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlayTest.java new file mode 100644 index 0000000000..ace4ce43e1 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlayTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2020, 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.combatlevel; + +import com.google.inject.Guice; +import com.google.inject.Inject; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import net.runelite.api.Client; +import net.runelite.api.Skill; +import net.runelite.client.ui.overlay.tooltip.TooltipManager; +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.when; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class CombatLevelOverlayTest +{ + @Mock + @Bind + private Client client; + + @Mock + @Bind + private CombatLevelConfig combatLevelConfig; + + @Mock + @Bind + private TooltipManager tooltipManager; + + @Inject + private CombatLevelOverlay combatLevelOverlay; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + } + + @Test + public void testGetLevelsUntilTooltip() + { + when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(99); + when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(99); + when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(97); + when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(99); + when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(99); + when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(99); + when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(94); + + assertEquals("Next combat level:
4 Defence/Hitpoints
8 Prayer", combatLevelOverlay.getLevelsUntilTooltip()); + } +} \ No newline at end of file From fa79a51bca871ad611b3bbec36146cd4d6fa6cdf Mon Sep 17 00:00:00 2001 From: Minhs2 <32379779+Minhs2@users.noreply.github.com> Date: Sat, 21 Nov 2020 07:49:55 -0800 Subject: [PATCH 003/173] slayer: add various monsters as alternatives to tasks --- .../runelite/client/plugins/slayer/Task.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java index 19d29bc4a2..79e89ba191 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java @@ -45,13 +45,13 @@ enum Task ALCHEMICAL_HYDRA("Alchemical Hydra", ItemID.IKKLE_HYDRA), ANKOU("Ankou", ItemID.ANKOU_MASK), AVIANSIES("Aviansies", ItemID.ENSOULED_AVIANSIE_HEAD), - BANDITS("Bandits", ItemID.BANDIT, "Bandit"), + BANDITS("Bandits", ItemID.BANDIT, "Bandit", "Black Heather", "Donny the Lad", "Speedy Keith"), BANSHEES("Banshees", ItemID.BANSHEE), BARROWS_BROTHERS("Barrows Brothers", ItemID.KARILS_COIF), BASILISKS("Basilisks", ItemID.BASILISK), - BATS("Bats", ItemID.GIRAL_BAT_2), + BATS("Bats", ItemID.GIRAL_BAT_2, "Death wing"), BEARS("Bears", ItemID.ENSOULED_BEAR_HEAD), - BIRDS("Birds", ItemID.FEATHER, "Chicken", "Rooster", "Terrorbird", "Seagull"), + BIRDS("Birds", ItemID.FEATHER, "Chicken", "Rooster", "Terrorbird", "Seagull", "Vulture"), BLACK_DEMONS("Black demons", ItemID.BLACK_DEMON_MASK), BLACK_DRAGONS("Black dragons", ItemID.BLACK_DRAGON_MASK, "Baby black dragon"), BLACK_KNIGHTS("Black Knights", ItemID.BLACK_FULL_HELM, "Black Knight"), @@ -83,9 +83,9 @@ enum Task DOGS("Dogs", ItemID.GUARD_DOG, "Jackal"), DRAKES("Drakes", ItemID.DRAKE), DUST_DEVILS("Dust devils", ItemID.DUST_DEVIL, "Choke devil"), - DWARVES("Dwarves", ItemID.DWARVEN_HELMET, "Dwarf"), + DWARVES("Dwarves", ItemID.DWARVEN_HELMET, "Dwarf", "Black Guard"), EARTH_WARRIORS("Earth warriors", ItemID.BRONZE_FULL_HELM_T), - ELVES("Elves", ItemID.ELF, "Elf", "Iorwerth Warrior"), + ELVES("Elves", ItemID.ELF, "Elf", "Iorwerth Warrior", "Iorwerth Archer"), ENTS("Ents", ItemID.NICE_TREE, "Ent"), FEVER_SPIDERS("Fever spiders", ItemID.FEVER_SPIDER), FIRE_GIANTS("Fire giants", ItemID.FIRE_BATTLESTAFF), @@ -93,12 +93,12 @@ enum Task FOSSIL_ISLAND_WYVERNS("Fossil island wyverns", ItemID.FOSSIL_ISLAND_WYVERN, "Ancient wyvern", "Long-tailed wyvern", "Spitting wyvern", "Taloned wyvern"), GARGOYLES("Gargoyles", ItemID.GARGOYLE, 9, ItemID.ROCK_HAMMER), GENERAL_GRAARDOR("General Graardor", ItemID.PET_GENERAL_GRAARDOR), - GHOSTS("Ghosts", ItemID.GHOSTSPEAK_AMULET, "Tortured soul"), + GHOSTS("Ghosts", ItemID.GHOSTSPEAK_AMULET, "Death wing", "Tortured soul"), GHOULS("Ghouls", ItemID.ZOMBIE_HEAD), GIANT_MOLE("Giant Mole", ItemID.BABY_MOLE), GOBLINS("Goblins", ItemID.ENSOULED_GOBLIN_HEAD), GREATER_DEMONS("Greater demons", ItemID.GREATER_DEMON_MASK), - GREEN_DRAGONS("Green dragons", ItemID.GREEN_DRAGON_MASK, "Baby green dragon"), + GREEN_DRAGONS("Green dragons", ItemID.GREEN_DRAGON_MASK, "Baby green dragon", "Elvarg"), GROTESQUE_GUARDIANS("Grotesque Guardians", ItemID.MIDNIGHT, 0, ItemID.ROCK_HAMMER, "Dusk", "Dawn"), HARPIE_BUG_SWARMS("Harpie bug swarms", ItemID.SWARM), HELLHOUNDS("Hellhounds", ItemID.HELLHOUND), @@ -107,7 +107,7 @@ enum Task HYDRAS("Hydras", ItemID.HYDRA), ICEFIENDS("Icefiends", ItemID.ICE_DIAMOND), ICE_GIANTS("Ice giants", ItemID.ICE_DIAMOND), - ICE_WARRIORS("Ice warriors", ItemID.MITHRIL_FULL_HELM_T), + ICE_WARRIORS("Ice warriors", ItemID.MITHRIL_FULL_HELM_T, "Icelord"), INFERNAL_MAGES("Infernal mages", ItemID.INFERNAL_MAGE, "Malevolent mage"), IRON_DRAGONS("Iron dragons", ItemID.IRON_DRAGON_MASK), JAD("TzTok-Jad", ItemID.TZREKJAD, 25250), @@ -132,7 +132,7 @@ enum Task MITHRIL_DRAGONS("Mithril dragons", ItemID.MITHRIL_DRAGON_MASK), MOGRES("Mogres", ItemID.MOGRE), MOLANISKS("Molanisks", ItemID.MOLANISK), - MONKEYS("Monkeys", ItemID.ENSOULED_MONKEY_HEAD), + MONKEYS("Monkeys", ItemID.ENSOULED_MONKEY_HEAD, "Tortured gorilla"), MOSS_GIANTS("Moss giants", ItemID.HILL_GIANT_CLUB), MUTATED_ZYGOMITES("Mutated zygomites", ItemID.MUTATED_ZYGOMITE, 7, ItemID.FUNGICIDE_SPRAY_0, "Zygomite", "Fungi"), NECHRYAEL("Nechryael", ItemID.NECHRYAEL, "Nechryarch"), @@ -164,7 +164,7 @@ enum Task TEMPLE_SPIDERS("Temple Spiders", ItemID.RED_SPIDERS_EGGS), TERROR_DOGS("Terror dogs", ItemID.TERROR_DOG), THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear Smoke Devil", ItemID.PET_SMOKE_DEVIL), - TROLLS("Trolls", ItemID.TROLL_GUARD), + TROLLS("Trolls", ItemID.TROLL_GUARD, "Dad", "Arrg"), TUROTH("Turoth", ItemID.TUROTH), TZHAAR("Tzhaar", ItemID.ENSOULED_TZHAAR_HEAD), UNDEAD_DRUIDS("Undead Druids", ItemID.MASK_OF_RANUL), From 2778dc69b476846d5d97038bb172b713edc486f8 Mon Sep 17 00:00:00 2001 From: Plondrein Date: Sun, 18 Oct 2020 21:42:31 +0200 Subject: [PATCH 004/173] menu swapper: Add NPC Deposit-Items swap --- .../menuentryswapper/MenuEntrySwapperConfig.java | 11 +++++++++++ .../menuentryswapper/MenuEntrySwapperPlugin.java | 1 + 2 files changed, 12 insertions(+) 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 bceea79f33..21116633b3 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 @@ -595,4 +595,15 @@ public interface MenuEntrySwapperConfig extends Config { return false; } + + @ConfigItem( + keyName = "swapDepositItems", + name = "Deposit Items", + description = "Swap Talk-to with Deposit-items", + section = npcSection + ) + default boolean swapDepositItems() + { + return false; + } } 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 f4cacb4a36..fc868c6de4 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 @@ -211,6 +211,7 @@ public class MenuEntrySwapperPlugin extends Plugin swap("talk-to", "start-minigame", config::swapStartMinigame); swap("talk-to", ESSENCE_MINE_NPCS::contains, "teleport", config::swapEssenceMineTeleport); swap("talk-to", "collect", config::swapCollectMiscellania); + swap("talk-to", "deposit-items", config::swapDepositItems); swap("leave tomb", "quick-leave", config::swapQuickLeave); swap("tomb door", "quick-leave", config::swapQuickLeave); From 6552355fd737f45c3a438f69381dd29b7dbc3e4c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 21 Nov 2020 23:22:31 -0500 Subject: [PATCH 005/173] Move BankSearch to bank plugin It contains no bank tab specific code and is used by both the bank and banktags plugins --- .../main/java/net/runelite/client/plugins/bank/BankPlugin.java | 1 - .../client/plugins/{banktags/tabs => bank}/BankSearch.java | 2 +- .../net/runelite/client/plugins/banktags/tabs/TabInterface.java | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) rename runelite-client/src/main/java/net/runelite/client/plugins/{banktags/tabs => bank}/BankSearch.java (98%) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java index e80aaa697e..dca67f75a4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java @@ -63,7 +63,6 @@ import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.banktags.tabs.BankSearch; import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java similarity index 98% rename from runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java rename to runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java index f607415c38..7ae0995dc1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java @@ -23,7 +23,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.client.plugins.banktags.tabs; +package net.runelite.client.plugins.bank; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index 3b3a7037d6..ffaf7da3b0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -83,6 +83,7 @@ import net.runelite.client.callback.ClientThread; import net.runelite.client.game.ItemManager; import net.runelite.client.game.chatbox.ChatboxItemSearch; import net.runelite.client.game.chatbox.ChatboxPanelManager; +import net.runelite.client.plugins.bank.BankSearch; import net.runelite.client.plugins.banktags.BankTagsConfig; import net.runelite.client.plugins.banktags.BankTagsPlugin; import static net.runelite.client.plugins.banktags.BankTagsPlugin.TAG_SEARCH; From 514995d140b14a5809629b6301d33c2702988f0e Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Nov 2020 11:43:18 -0500 Subject: [PATCH 006/173] banktags: use script event for detecting bank search The bank plugin is being changed to manually initiate bank searches, by invoking the script, and the bank tabs plugin needs to be able to detect this search too. --- .../plugins/banktags/BankTagsPlugin.java | 7 ++++- .../plugins/banktags/tabs/TabInterface.java | 29 ++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index d1e491e19e..1cffe75379 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -458,7 +458,8 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener @Subscribe public void onScriptPreFired(ScriptPreFired event) { - if (event.getScriptId() == ScriptID.BANKMAIN_FINISHBUILDING) + int scriptId = event.getScriptId(); + if (scriptId == ScriptID.BANKMAIN_FINISHBUILDING) { // Since we apply tag tab search filters even when the bank is not in search mode, // bankkmain_build will reset the bank title to "The Bank of Gielinor". So apply our @@ -476,6 +477,10 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener bankTitle.setText("Tag tab " + activeTab.getTag() + ""); } } + else if (scriptId == ScriptID.BANKMAIN_SEARCH_TOGGLE) + { + tabInterface.handleSearch(); + } } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index ffaf7da3b0..0564d7b38b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -347,7 +347,7 @@ public class TabInterface final Iterator dataIter = Text.fromCSV(dataString).iterator(); String name = dataIter.next(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (char c : name.toCharArray()) { if (FILTERED_CHARS.test(c)) @@ -369,7 +369,7 @@ public class TabInterface while (dataIter.hasNext()) { - final int itemId = Integer.valueOf(dataIter.next()); + final int itemId = Integer.parseInt(dataIter.next()); tagManager.addTag(itemId, name, itemId < 0); } @@ -656,16 +656,6 @@ public class TabInterface } if (activeTab != null - && event.getMenuOption().equals("Search") - && client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND).getSpriteId() != SpriteID.EQUIPMENT_SLOT_SELECTED) - { - activateTab(null); - // This ensures that when clicking Search when tab is selected, the search input is opened rather - // than client trying to close it first - client.setVar(VarClientStr.INPUT_TEXT, ""); - client.setVar(VarClientInt.INPUT_TYPE, 0); - } - else if (activeTab != null && (event.getMenuOption().startsWith("View tab") || event.getMenuOption().equals("View all items"))) { activateTab(null); @@ -696,6 +686,18 @@ public class TabInterface } } + public void handleSearch() + { + if (activeTab != null) + { + activateTab(null); + // This ensures that when clicking Search when tab is selected, the search input is opened rather + // than client trying to close it first + client.setVar(VarClientStr.INPUT_TEXT, ""); + client.setVar(VarClientInt.INPUT_TYPE, 0); + } + } + public void updateTabIfActive(final Collection tags) { if (activeTab != null && tags.contains(activeTab.getTag())) @@ -1158,11 +1160,10 @@ public class TabInterface t.revalidate(); } - private ItemComposition getItem(int idx) { ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK); - Item item = bankContainer.getItems()[idx]; + Item item = bankContainer.getItem(idx); return itemManager.getItemComposition(item.getId()); } From 87f5e98a0882f2250af1e580c192baa6e7a7d215 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sun, 27 Oct 2019 16:09:25 -0400 Subject: [PATCH 007/173] bank plugin: add ctrl+f hotkey to initiate bank search Co-authored-by: melkypie <5113962+melkypie@users.noreply.github.com> Co-authored-by: Adam --- .../main/java/net/runelite/api/ScriptID.java | 14 ++++++ .../client/plugins/bank/BankConfig.java | 14 ++++++ .../client/plugins/bank/BankPlugin.java | 46 +++++++++++++++++++ .../client/plugins/bank/BankSearch.java | 27 +++++++++++ 4 files changed, 101 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index b5d1bb0fbc..3e9e426d4d 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -299,4 +299,18 @@ public final class ScriptID @ScriptArguments() public static final int BANKMAIN_SEARCHING = 514; + + /** + * Toggles the bank search + * + *
    + *
  • int 1 (must be 1 or script immediately returns)
  • + *
+ * + * Also takes 17 widget IDs corresponding to various bank widgets. + * These can be retrieved from the onInvTransmitListener of BANK_ITEM_CONTAINER. Note that this array also + * contains the script ID for the bank layout script in the first index + */ + @ScriptArguments(integer = 18) + public static final int BANKMAIN_SEARCH_TOGGLE = 281; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java index f51625bff5..002e01a3d4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java @@ -25,9 +25,12 @@ */ package net.runelite.client.plugins.bank; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Keybind; @ConfigGroup("bank") public interface BankConfig extends Config @@ -119,4 +122,15 @@ public interface BankConfig extends Config { return false; } + + @ConfigItem( + keyName = "searchKeybind", + name = "Search Shortcut", + description = "Keyboard shortcut for initiating a bank search", + position = 9 + ) + default Keybind searchKeybind() + { + return new Keybind(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java index dca67f75a4..e0e1efbd5c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java @@ -30,6 +30,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultiset; import com.google.common.collect.Multiset; import com.google.inject.Provides; +import java.awt.event.KeyEvent; import java.text.ParseException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -59,8 +60,11 @@ import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; +import net.runelite.client.config.Keybind; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; +import net.runelite.client.input.KeyListener; +import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.util.QuantityFormatter; @@ -98,19 +102,61 @@ public class BankPlugin extends Plugin @Inject private BankSearch bankSearch; + @Inject + private KeyManager keyManager; + private boolean forceRightClickFlag; private Multiset itemQuantities; // bank item quantities for bank value search private String searchString; + private final KeyListener searchHotkeyListener = new KeyListener() + { + @Override + public void keyTyped(KeyEvent e) + { + } + + @Override + public void keyPressed(KeyEvent e) + { + Keybind keybind = config.searchKeybind(); + if (keybind.matches(e)) + { + Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); + if (bankContainer == null || bankContainer.isSelfHidden()) + { + return; + } + + log.debug("Search hotkey pressed"); + + bankSearch.initSearch(); + e.consume(); + } + } + + @Override + public void keyReleased(KeyEvent e) + { + } + }; + @Provides BankConfig getConfig(ConfigManager configManager) { return configManager.getConfig(BankConfig.class); } + @Override + protected void startUp() + { + keyManager.registerKeyListener(searchHotkeyListener); + } + @Override protected void shutDown() { + keyManager.unregisterKeyListener(searchHotkeyListener); clientThread.invokeLater(() -> bankSearch.reset(false)); forceRightClickFlag = false; itemQuantities = null; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java index 7ae0995dc1..73e00b436e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankSearch.java @@ -35,6 +35,7 @@ import net.runelite.api.vars.InputType; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.callback.ClientThread; +import org.apache.commons.lang3.ArrayUtils; @Singleton public class BankSearch @@ -69,6 +70,32 @@ public class BankSearch client.runScript(scriptArgs); } + public void initSearch() + { + clientThread.invoke(() -> + { + Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); + if (bankContainer == null || bankContainer.isHidden()) + { + return; + } + + Object[] bankBuildArgs = bankContainer.getOnInvTransmitListener(); + if (bankBuildArgs == null) + { + return; + } + + // the search toggle script requires 1 as its first argument + Object[] searchToggleArgs = ArrayUtils.insert(1, bankBuildArgs, 1); + searchToggleArgs[0] = ScriptID.BANKMAIN_SEARCH_TOGGLE; + + // reset search to clear tab tags and also allow us to initiate a new search while searching + reset(true); + client.runScript(searchToggleArgs); + }); + } + public void reset(boolean closeChat) { clientThread.invoke(() -> From 1f3634d429d561165132c0616b051c65592a152f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Nov 2020 15:42:45 -0500 Subject: [PATCH 008/173] Fix incorrectly marking Al Kharid west shortcut window The west window has the same id as the east window, causing both to be marked by the agility plugin. This adds a matches() method to AgilityShortcut to allow the plugin to test specifically which window matches the shortcut. --- .../runelite/client/game/AgilityShortcut.java | 16 +++++++++++++++- .../client/plugins/agility/AgilityPlugin.java | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java index 315232c4df..d7a50592f6 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -28,6 +28,7 @@ package net.runelite.client.game; import lombok.Getter; import static net.runelite.api.NullObjectID.*; import static net.runelite.api.ObjectID.*; +import net.runelite.api.TileObject; import net.runelite.api.coords.WorldPoint; @Getter @@ -184,7 +185,15 @@ public enum AgilityShortcut TAVERLEY_DUNGEON_ROCKS_SOUTH(70, "Rocks", new WorldPoint(2887, 9631, 0), ROCKS, ROCKS_14106), FOSSIL_ISLAND_HARDWOOD_NORTH(70, "Hole" , new WorldPoint(3712, 3828, 0), HOLE_31481, HOLE_31482), FOSSIL_ISLAND_HARDWOOD_SOUTH(70, "Hole" , new WorldPoint(3714, 3816, 0), HOLE_31481, HOLE_31482), - AL_KHARID_WINDOW(70, "Window", new WorldPoint(3293, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW), + AL_KHARID_WINDOW(70, "Window", new WorldPoint(3295, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW) + { + @Override + public boolean matches(TileObject object) + { + // there are two BIG_WINDOW objects right next to each other here, but only this one is valid + return object.getId() != BIG_WINDOW || object.getWorldLocation().equals(getWorldLocation()); + } + }, GWD_SARADOMIN_ROPE_NORTH(70, "Rope Descent", new WorldPoint(2912, 5300, 0), NULL_26371, NULL_26561), GWD_SARADOMIN_ROPE_SOUTH(70, "Rope Descent", new WorldPoint(2951, 5267, 0), NULL_26375, NULL_26562), GU_TANOTH_CRUMBLING_WALL(71, "Rocks", new WorldPoint(2545, 3032, 0), CRUMBLING_WALL_40355, ROCKS_40356), @@ -265,4 +274,9 @@ public enum AgilityShortcut { return description + " - Level " + level; } + + public boolean matches(TileObject object) + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java index a3abe20df1..b79de676b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java @@ -452,6 +452,11 @@ public class AgilityPlugin extends Plugin // Find the closest shortcut to this object for (AgilityShortcut shortcut : Obstacles.SHORTCUT_OBSTACLE_IDS.get(newObject.getId())) { + if (!shortcut.matches(newObject)) + { + continue; + } + if (shortcut.getWorldLocation() == null) { closestShortcut = shortcut; From e5b5292267b3240f7320c05f4c232e4d66b0142b Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Nov 2020 18:25:44 -0500 Subject: [PATCH 009/173] objectindicators: fix not marking objects when loaded on other planes fromLocalInstance() was returning a world point using the clients plane, however the object may not be on that, causing the plane check in checkObjectPoints() to fail. --- .../net/runelite/api/coords/WorldPoint.java | 20 ++++++++++++++++--- .../ObjectIndicatorsPlugin.java | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java index e2b57bdbc5..780c7c4494 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/WorldPoint.java @@ -163,6 +163,20 @@ public class WorldPoint * @return the tile coordinate containing the local point */ public static WorldPoint fromLocalInstance(Client client, LocalPoint localPoint) + { + return fromLocalInstance(client, localPoint, client.getPlane()); + } + + /** + * Gets the coordinate of the tile that contains the passed local point, + * accounting for instances. + * + * @param client the client + * @param localPoint the local coordinate + * @param plane the plane for the returned point, if it is not an instance + * @return the tile coordinate containing the local point + */ + public static WorldPoint fromLocalInstance(Client client, LocalPoint localPoint, int plane) { if (client.isInInstancedRegion()) { @@ -181,18 +195,18 @@ public class WorldPoint int rotation = templateChunk >> 1 & 0x3; int templateChunkY = (templateChunk >> 3 & 0x7FF) * CHUNK_SIZE; int templateChunkX = (templateChunk >> 14 & 0x3FF) * CHUNK_SIZE; - int plane = templateChunk >> 24 & 0x3; + int templateChunkPlane = templateChunk >> 24 & 0x3; // calculate world point of the template int x = templateChunkX + (sceneX & (CHUNK_SIZE - 1)); int y = templateChunkY + (sceneY & (CHUNK_SIZE - 1)); // create and rotate point back to 0, to match with template - return rotate(new WorldPoint(x, y, plane), 4 - rotation); + return rotate(new WorldPoint(x, y, templateChunkPlane), 4 - rotation); } else { - return fromLocal(client, localPoint); + return fromLocal(client, localPoint.getX(), localPoint.getY(), plane); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java index 29a39edf98..46a4a0924d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java @@ -278,7 +278,7 @@ public class ObjectIndicatorsPlugin extends Plugin private void checkObjectPoints(TileObject object) { - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); + final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation(), object.getPlane()); final Set objectPoints = points.get(worldPoint.getRegionID()); if (objectPoints == null) From 3bc7bff4aedc9631d1a37bf4a6fd765d5cc1cfd4 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 22 Nov 2020 18:54:35 -0700 Subject: [PATCH 010/173] runelite-api: add WorldChanged event --- .../net/runelite/api/events/WorldChanged.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java new file mode 100644 index 0000000000..57fcb00ee6 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/WorldChanged.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Abex + * 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.api.events; + +import net.runelite.api.Client; + +/** + * Posted when the game world the client wants to connect to has changed + * This is posted after the world ID and type have updated, but before a new + * connection is established + * + * @see Client#getWorld() + * @see Client#getWorldType() + */ +public class WorldChanged +{ +} From 2ac456696b35c45366f93d6b26fcf96f6d77dccb Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 23 Nov 2020 09:47:12 -0700 Subject: [PATCH 011/173] runelite-api: add PlayerChanged event --- .../runelite/api/events/PlayerChanged.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/PlayerChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/PlayerChanged.java b/runelite-api/src/main/java/net/runelite/api/events/PlayerChanged.java new file mode 100644 index 0000000000..c29f30dc1d --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/PlayerChanged.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Abex + * 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.api.events; + +import lombok.Value; +import net.runelite.api.Player; + +@Value +public class PlayerChanged +{ + private final Player player; +} From 922c5e342117669e7dff40408c622610143d6933 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 24 Nov 2020 18:45:37 -0500 Subject: [PATCH 012/173] cache: fix objexporter hsl to rgb calculation This was doing hsb to rgb instead --- .../net/runelite/cache/models/JagexColor.java | 136 +++++++++++++ .../runelite/cache/models/ObjExporter.java | 20 +- .../runelite/cache/models/JagexColorTest.java | 178 ++++++++++++++++++ 3 files changed, 320 insertions(+), 14 deletions(-) create mode 100644 cache/src/main/java/net/runelite/cache/models/JagexColor.java create mode 100644 cache/src/test/java/net/runelite/cache/models/JagexColorTest.java diff --git a/cache/src/main/java/net/runelite/cache/models/JagexColor.java b/cache/src/main/java/net/runelite/cache/models/JagexColor.java new file mode 100644 index 0000000000..993073bf90 --- /dev/null +++ b/cache/src/main/java/net/runelite/cache/models/JagexColor.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2020 Abex + * 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.cache.models; + +public final class JagexColor +{ + public static final double BRIGHTNESS_MAX = .6; + public static final double BRIGHTNESS_HIGH = .7; + public static final double BRIGHTNESS_LOW = .8; + public static final double BRIGTHNESS_MIN = .9; + + private static final double HUE_OFFSET = (.5 / 64.D); + private static final double SATURATION_OFFSET = (.5 / 8.D); + + private JagexColor() + { + } + + public static short packHSL(int hue, int saturation, int luminance) + { + return (short) ((short) (hue & 63) << 10 + | (short) (saturation & 7) << 7 + | (short) (luminance & 127)); + } + + public static int unpackHue(short hsl) + { + return hsl >> 10 & 63; + } + + public static int unpackSaturation(short hsl) + { + return hsl >> 7 & 7; + } + + public static int unpackLuminance(short hsl) + { + return hsl & 127; + } + + public static String formatHSL(short hsl) + { + return String.format("%02Xh%Xs%02Xl", unpackHue(hsl), unpackSaturation(hsl), unpackLuminance(hsl)); + } + + public static int HSLtoRGB(short hsl, double brightness) + { + double hue = (double) unpackHue(hsl) / 64.D + HUE_OFFSET; + double saturation = (double) unpackSaturation(hsl) / 8.D + SATURATION_OFFSET; + double luminance = (double) unpackLuminance(hsl) / 128.D; + + // This is just a standard hsl to rgb transform + // the only difference is the offsets above and the brightness transform below + double chroma = (1.D - Math.abs((2.D * luminance) - 1.D)) * saturation; + double x = chroma * (1 - Math.abs(((hue * 6.D) % 2.D) - 1.D)); + double lightness = luminance - (chroma / 2); + + double r = lightness, g = lightness, b = lightness; + switch ((int) (hue * 6.D)) + { + case 0: + r += chroma; + g += x; + break; + case 1: + g += chroma; + r += x; + break; + case 2: + g += chroma; + b += x; + break; + case 3: + b += chroma; + g += x; + break; + case 4: + b += chroma; + r += x; + break; + default: + r += chroma; + b += x; + break; + } + + int rgb = ((int) (r * 256.0D) << 16) + | ((int) (g * 256.0D) << 8) + | (int) (b * 256.0D); + + rgb = adjustForBrightness(rgb, brightness); + + if (rgb == 0) + { + rgb = 1; + } + return rgb; + } + + public static int adjustForBrightness(int rgb, double brightness) + { + double r = (double) (rgb >> 16) / 256.0D; + double g = (double) (rgb >> 8 & 255) / 256.0D; + double b = (double) (rgb & 255) / 256.0D; + + r = Math.pow(r, brightness); + g = Math.pow(g, brightness); + b = Math.pow(b, brightness); + + return ((int) (r * 256.0D) << 16) + | ((int) (g * 256.0D) << 8) + | (int) (b * 256.0D); + } +} \ No newline at end of file diff --git a/cache/src/main/java/net/runelite/cache/models/ObjExporter.java b/cache/src/main/java/net/runelite/cache/models/ObjExporter.java index 8913610177..fb65f99972 100644 --- a/cache/src/main/java/net/runelite/cache/models/ObjExporter.java +++ b/cache/src/main/java/net/runelite/cache/models/ObjExporter.java @@ -24,7 +24,6 @@ */ package net.runelite.cache.models; -import java.awt.Color; import java.io.PrintWriter; import net.runelite.cache.TextureManager; import net.runelite.cache.definitions.ModelDefinition; @@ -32,6 +31,8 @@ import net.runelite.cache.definitions.TextureDefinition; public class ObjExporter { + private static final double BRIGHTNESS = JagexColor.BRIGTHNESS_MIN; + private final TextureManager textureManager; private final ModelDefinition model; @@ -111,11 +112,10 @@ public class ObjExporter if (textureId == -1) { - Color color = rs2hsbToColor(model.faceColors[i]); - - double r = color.getRed() / 255.0; - double g = color.getGreen() / 255.0; - double b = color.getBlue() / 255.0; + int rgb = JagexColor.HSLtoRGB( model.faceColors[i], BRIGHTNESS); + double r = ((rgb >> 16) & 0xff) / 255.0; + double g = ((rgb >> 8) & 0xff) / 255.0; + double b = (rgb & 0xff) / 255.0; mtlWriter.println("Kd " + r + " " + g + " " + b); } @@ -140,12 +140,4 @@ public class ObjExporter } } } - - private static Color rs2hsbToColor(int hsb) - { - int decode_hue = (hsb >> 10) & 0x3f; - int decode_saturation = (hsb >> 7) & 0x07; - int decode_brightness = (hsb & 0x7f); - return Color.getHSBColor((float) decode_hue / 63, (float) decode_saturation / 7, (float) decode_brightness / 127); - } } diff --git a/cache/src/test/java/net/runelite/cache/models/JagexColorTest.java b/cache/src/test/java/net/runelite/cache/models/JagexColorTest.java new file mode 100644 index 0000000000..25291d4528 --- /dev/null +++ b/cache/src/test/java/net/runelite/cache/models/JagexColorTest.java @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2020 Abex + * 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.cache.models; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class JagexColorTest +{ + private static final double[] BRIGHTNESS_LEVELS = { + JagexColor.BRIGTHNESS_MIN, + JagexColor.BRIGHTNESS_LOW, + JagexColor.BRIGHTNESS_HIGH, + JagexColor.BRIGHTNESS_MAX, + }; + + // copy/pasted from the client, the reference colors + private static int[] computeColorTable(double brightness, int min, int max) + { + int[] colorPalette = new int[65536]; + int var4 = min * 128; + + for (int var5 = min; var5 < max; ++var5) + { + double var6 = (double) (var5 >> 3) / 64.0D + 0.0078125D; + double var8 = (double) (var5 & 7) / 8.0D + 0.0625D; + + for (int var10 = 0; var10 < 128; ++var10) + { + double var11 = (double) var10 / 128.0D; + double var13 = var11; + double var15 = var11; + double var17 = var11; + if (var8 != 0.0D) + { + double var19; + if (var11 < 0.5D) + { + var19 = var11 * (1.0D + var8); + } + else + { + var19 = var11 + var8 - var11 * var8; + } + + double var21 = 2.0D * var11 - var19; + double var23 = var6 + 0.3333333333333333D; + if (var23 > 1.0D) + { + --var23; + } + + double var27 = var6 - 0.3333333333333333D; + if (var27 < 0.0D) + { + ++var27; + } + + if (6.0D * var23 < 1.0D) + { + var13 = var21 + (var19 - var21) * 6.0D * var23; + } + else if (2.0D * var23 < 1.0D) + { + var13 = var19; + } + else if (3.0D * var23 < 2.0D) + { + var13 = var21 + (var19 - var21) * (0.6666666666666666D - var23) * 6.0D; + } + else + { + var13 = var21; + } + + if (6.0D * var6 < 1.0D) + { + var15 = var21 + (var19 - var21) * 6.0D * var6; + } + else if (2.0D * var6 < 1.0D) + { + var15 = var19; + } + else if (3.0D * var6 < 2.0D) + { + var15 = var21 + (var19 - var21) * (0.6666666666666666D - var6) * 6.0D; + } + else + { + var15 = var21; + } + + if (6.0D * var27 < 1.0D) + { + var17 = var21 + (var19 - var21) * 6.0D * var27; + } + else if (2.0D * var27 < 1.0D) + { + var17 = var19; + } + else if (3.0D * var27 < 2.0D) + { + var17 = var21 + (var19 - var21) * (0.6666666666666666D - var27) * 6.0D; + } + else + { + var17 = var21; + } + } + + int var29 = (int) (var13 * 256.0D); + int var20 = (int) (var15 * 256.0D); + int var30 = (int) (var17 * 256.0D); + int var22 = var30 + (var20 << 8) + (var29 << 16); + var22 = adjustForBrightness(var22, brightness); + if (var22 == 0) + { + var22 = 1; + } + + colorPalette[var4++] = var22; + } + } + + return colorPalette; + } + + private static int adjustForBrightness(int rgb, double brightness) + { + double var3 = (double) (rgb >> 16) / 256.0D; + double var5 = (double) (rgb >> 8 & 255) / 256.0D; + double var7 = (double) (rgb & 255) / 256.0D; + var3 = Math.pow(var3, brightness); + var5 = Math.pow(var5, brightness); + var7 = Math.pow(var7, brightness); + int var9 = (int) (var3 * 256.0D); + int var10 = (int) (var5 * 256.0D); + int var11 = (int) (var7 * 256.0D); + return var11 + (var10 << 8) + (var9 << 16); + } + + @Test + public void testHslToRgb() + { + for (double brightness : BRIGHTNESS_LEVELS) + { + int[] colorPalette = computeColorTable(brightness, 0, 512); + for (int i = 0; i < 0xFFFF; i++) + { + int rgb = JagexColor.HSLtoRGB((short) i, brightness); + int crgb = colorPalette[i]; + assertEquals("idx " + i + " brightness " + brightness, crgb, rgb); + } + } + } +} \ No newline at end of file From 2357fa27d74b026809bdf02431856a2a19673ca9 Mon Sep 17 00:00:00 2001 From: dekvall Date: Mon, 26 Oct 2020 21:56:36 +0100 Subject: [PATCH 013/173] plugin-panel: stick plugin hub button to bottom of plugin list --- .../net/runelite/client/plugins/config/PluginListPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListPanel.java index 0130688bc8..8894b0fcc9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListPanel.java @@ -179,11 +179,11 @@ class PluginListPanel extends PluginPanel externalPluginButton.setBorder(new EmptyBorder(5, 5, 5, 5)); externalPluginButton.setLayout(new BorderLayout(0, BORDER_OFFSET)); externalPluginButton.addActionListener(l -> muxer.pushState(pluginHubPanelProvider.get())); + add(externalPluginButton, BorderLayout.SOUTH); JPanel northPanel = new FixedWidthPanel(); northPanel.setLayout(new BorderLayout()); northPanel.add(mainPanel, BorderLayout.NORTH); - northPanel.add(externalPluginButton, BorderLayout.SOUTH); scrollPane = new JScrollPane(northPanel); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); From f0787178229d967477fea5d52ae35022f712fbde Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 22 Nov 2020 19:00:13 -0700 Subject: [PATCH 014/173] runelite-client: add rsprofile support --- .../runelite/client/config/ConfigManager.java | 508 ++++++++++++++++-- .../client/config/RuneScapeProfile.java | 45 ++ .../client/config/RuneScapeProfileType.java | 59 ++ .../runelite/client/events/ConfigChanged.java | 10 + .../events/RuneScapeProfileChanged.java | 34 ++ .../chatcommands/ChatCommandsPlugin.java | 12 +- .../grandexchange/GrandExchangePlugin.java | 21 +- .../timetracking/TimeTrackingPlugin.java | 4 +- .../farming/FarmingContractManager.java | 12 +- .../timetracking/farming/FarmingTracker.java | 27 +- .../timetracking/hunter/BirdHouseTracker.java | 12 +- .../client/config/ConfigManagerTest.java | 28 + .../chatcommands/ChatCommandsPluginTest.java | 142 +++-- .../GrandExchangePluginTest.java | 9 +- 14 files changed, 746 insertions(+), 177 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfile.java create mode 100644 runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java create mode 100644 runelite-client/src/main/java/net/runelite/client/events/RuneScapeProfileChanged.java diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index b13c54140c..c86df2d2b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -24,9 +24,13 @@ */ package net.runelite.client.config; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.ComparisonChain; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.hash.Hasher; +import com.google.common.hash.Hashing; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; @@ -45,34 +49,50 @@ import java.nio.charset.StandardCharsets; import java.nio.file.AtomicMoveNotSupportedException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.security.SecureRandom; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.time.Duration; import java.time.Instant; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Base64; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Properties; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.Player; import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.PlayerChanged; +import net.runelite.api.events.UsernameChanged; +import net.runelite.api.events.WorldChanged; import net.runelite.client.RuneLite; import net.runelite.client.account.AccountSession; import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.ClientShutdown; import net.runelite.client.events.ConfigChanged; +import net.runelite.client.events.RuneScapeProfileChanged; import net.runelite.client.util.ColorUtil; import net.runelite.http.api.config.ConfigClient; import net.runelite.http.api.config.ConfigEntry; @@ -83,30 +103,52 @@ import okhttp3.OkHttpClient; @Slf4j public class ConfigManager { + public static final String RSPROFILE_GROUP = "rsprofile"; + + private static final String RSPROFILE_DISPLAY_NAME = "displayName"; + private static final String RSPROFILE_TYPE = "type"; + private static final String RSPROFILE_LOGIN_HASH = "loginHash"; + private static final String RSPROFILE_LOGIN_SALT = "loginSalt"; + private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); + @VisibleForTesting + static final Pattern KEY_SPLITTER = Pattern.compile("([^.]+)\\.(?:(" + RSPROFILE_GROUP + "\\.[^.]+)\\.)?(.*)"); + private static final int KEY_SPLITTER_GROUP = 1; + private static final int KEY_SPLITTER_PROFILE = 2; + private static final int KEY_SPLITTER_KEY = 3; + private final File settingsFileInput; private final EventBus eventBus; private final OkHttpClient okHttpClient; private AccountSession session; - private ConfigClient client; + private ConfigClient configClient; private File propertiesFile; + @Nullable + private final Client client; + private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this); private final Properties properties = new Properties(); private final Map pendingChanges = new HashMap<>(); + // null => we need to make a new profile + @Nullable + private String rsProfileKey; + @Inject public ConfigManager( @Named("config") File config, ScheduledExecutorService scheduledExecutorService, EventBus eventBus, - OkHttpClient okHttpClient) + OkHttpClient okHttpClient, + @Nullable Client client) { this.settingsFileInput = config; this.eventBus = eventBus; this.okHttpClient = okHttpClient; + this.client = client; this.propertiesFile = getPropertiesFile(); scheduledExecutorService.scheduleWithFixedDelay(this::sendConfig, 30, 30, TimeUnit.SECONDS); @@ -120,12 +162,12 @@ public class ConfigManager if (session == null) { this.session = null; - this.client = null; + this.configClient = null; } else { this.session = session; - this.client = new ConfigClient(okHttpClient, session.getUuid()); + this.configClient = new ConfigClient(okHttpClient, session.getUuid()); } this.propertiesFile = getPropertiesFile(); @@ -154,7 +196,7 @@ public class ConfigManager public void load() { - if (client == null) + if (configClient == null) { loadFromFile(); return; @@ -164,7 +206,7 @@ public class ConfigManager try { - configuration = client.get(); + configuration = configClient.get(); } catch (IOException ex) { @@ -186,26 +228,30 @@ public class ConfigManager for (ConfigEntry entry : configuration.getConfig()) { log.debug("Loading configuration value from client {}: {}", entry.getKey(), entry.getValue()); - final String[] split = entry.getKey().split("\\.", 2); - if (split.length != 2) + Matcher matcher = KEY_SPLITTER.matcher(entry.getKey()); + if (!matcher.find()) { continue; } - final String groupName = split[0]; - final String key = split[1]; + final String groupName = matcher.group(KEY_SPLITTER_GROUP); + final String profile = matcher.group(KEY_SPLITTER_PROFILE); + final String key = matcher.group(KEY_SPLITTER_KEY); final String value = entry.getValue(); final String oldValue = (String) properties.setProperty(entry.getKey(), value); ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); + configChanged.setProfile(profile); configChanged.setKey(key); configChanged.setOldValue(oldValue); configChanged.setNewValue(value); eventBus.post(configChanged); } + migrateConfig(); + try { saveToFile(propertiesFile); @@ -232,36 +278,39 @@ public class ConfigManager } final Map copy = (Map) ImmutableMap.copyOf(this.properties); - copy.forEach((groupAndKey, value) -> + copy.forEach((wholeKey, value) -> { - if (!properties.containsKey(groupAndKey)) + if (!properties.containsKey(wholeKey)) { - final String[] split = groupAndKey.split("\\.", 2); - if (split.length != 2) + Matcher matcher = KEY_SPLITTER.matcher(wholeKey); + if (!matcher.find()) { return; } - final String groupName = split[0]; - final String key = split[1]; - unsetConfiguration(groupName, key); + String groupName = matcher.group(KEY_SPLITTER_GROUP); + String profile = matcher.group(KEY_SPLITTER_PROFILE); + String key = matcher.group(KEY_SPLITTER_KEY); + unsetConfiguration(groupName, profile, key); } }); - properties.forEach((objGroupAndKey, objValue) -> + properties.forEach((wholeKey, objValue) -> { - final String groupAndKey = String.valueOf(objGroupAndKey); - final String[] split = groupAndKey.split("\\.", 2); - if (split.length != 2) + Matcher matcher = KEY_SPLITTER.matcher((String) wholeKey); + if (!matcher.find()) { return; } - final String groupName = split[0]; - final String key = split[1]; - final String value = String.valueOf(objValue); - setConfiguration(groupName, key, value); + String groupName = matcher.group(KEY_SPLITTER_GROUP); + String profile = matcher.group(KEY_SPLITTER_PROFILE); + String key = matcher.group(KEY_SPLITTER_KEY); + String value = String.valueOf(objValue); + setConfiguration(groupName, profile, key, value); }); + + migrateConfig(); } public void importLocal() @@ -308,21 +357,23 @@ public class ConfigManager try { Map copy = (Map) ImmutableMap.copyOf(properties); - copy.forEach((groupAndKey, value) -> + copy.forEach((wholeKey, value) -> { - final String[] split = groupAndKey.split("\\.", 2); - if (split.length != 2) + Matcher matcher = KEY_SPLITTER.matcher(wholeKey); + if (!matcher.find()) { - log.debug("Properties key malformed!: {}", groupAndKey); - properties.remove(groupAndKey); + log.debug("Properties key malformed!: {}", wholeKey); + properties.remove(wholeKey); return; } - final String groupName = split[0]; - final String key = split[1]; + String groupName = matcher.group(KEY_SPLITTER_GROUP); + String profile = matcher.group(KEY_SPLITTER_PROFILE); + String key = matcher.group(KEY_SPLITTER_KEY); ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); + configChanged.setProfile(profile); configChanged.setKey(key); configChanged.setOldValue(null); configChanged.setNewValue(value); @@ -333,6 +384,8 @@ public class ConfigManager { log.warn("Error posting config events", ex); } + + migrateConfig(); } private void saveToFile(final File propertiesFile) throws IOException @@ -381,14 +434,58 @@ public class ConfigManager return properties.keySet().stream().filter(v -> ((String) v).startsWith(prefix)).map(String.class::cast).collect(Collectors.toList()); } + public static String getWholeKey(String groupName, String profile, String key) + { + if (profile == null) + { + return groupName + "." + key; + } + else + { + return groupName + "." + profile + "." + key; + } + } + public String getConfiguration(String groupName, String key) { - return properties.getProperty(groupName + "." + key); + return getConfiguration(groupName, null, key); + } + + public String getRSProfileConfiguration(String groupName, String key) + { + String rsProfileKey = this.rsProfileKey; + if (rsProfileKey == null) + { + return null; + } + + return getConfiguration(groupName, rsProfileKey, key); + } + + public String getConfiguration(String groupName, String profile, String key) + { + return properties.getProperty(getWholeKey(groupName, profile, key)); } public T getConfiguration(String groupName, String key, Class clazz) { - String value = getConfiguration(groupName, key); + return getConfiguration(groupName, null, key, clazz); + } + + public T getRSProfileConfiguration(String groupName, String key, Class clazz) + { + String rsProfileKey = this.rsProfileKey; + if (rsProfileKey == null) + { + return null; + } + + return getConfiguration(groupName, rsProfileKey, key, clazz); + } + + public T getConfiguration(String groupName, String profile, String key, Class clazz) + { + String value = getConfiguration(groupName, profile, key); if (!Strings.isNullOrEmpty(value)) { try @@ -397,7 +494,7 @@ public class ConfigManager } catch (Exception e) { - log.warn("Unable to unmarshal {}.{} ", groupName, key, e); + log.warn("Unable to unmarshal {} ", getWholeKey(groupName, profile, key), e); } } return null; @@ -405,23 +502,31 @@ public class ConfigManager public void setConfiguration(String groupName, String key, String value) { - String oldValue = (String) properties.setProperty(groupName + "." + key, value); + setConfiguration(groupName, null, key, value); + } + + public void setConfiguration(String groupName, String profile, String key, String value) + { + assert !key.startsWith(RSPROFILE_GROUP + "."); + String wholeKey = getWholeKey(groupName, profile, key); + String oldValue = (String) properties.setProperty(wholeKey, value); if (Objects.equals(oldValue, value)) { return; } - log.debug("Setting configuration value for {}.{} to {}", groupName, key, value); + log.debug("Setting configuration value for {} to {}", wholeKey, value); handler.invalidate(); synchronized (pendingChanges) { - pendingChanges.put(groupName + "." + key, value); + pendingChanges.put(wholeKey, value); } ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); + configChanged.setProfile(profile); configChanged.setKey(key); configChanged.setOldValue(oldValue); configChanged.setNewValue(value); @@ -429,26 +534,74 @@ public class ConfigManager eventBus.post(configChanged); } + public void setConfiguration(String groupName, String profile, String key, Object value) + { + setConfiguration(groupName, profile, key, objectToString(value)); + } + public void setConfiguration(String groupName, String key, Object value) { - setConfiguration(groupName, key, objectToString(value)); + setConfiguration(groupName, null, key, value); + } + + public void setRSProfileConfiguration(String groupName, String key, Object value) + { + String rsProfileKey = this.rsProfileKey; + if (rsProfileKey == null) + { + if (client == null) + { + log.warn("trying to use profile without injected client"); + return; + } + + String displayName = null; + Player p = client.getLocalPlayer(); + if (p == null) + { + log.warn("trying to create profile without display name"); + } + else + { + displayName = p.getName(); + } + + String username = client.getUsername(); + if (Strings.isNullOrEmpty(username)) + { + log.warn("trying to create profile without a set username"); + return; + } + + RuneScapeProfile prof = findRSProfile(getRSProfiles(), username, RuneScapeProfileType.getCurrent(client), displayName, true); + rsProfileKey = prof.getKey(); + this.rsProfileKey = rsProfileKey; + } + setConfiguration(groupName, rsProfileKey, key, value); } public void unsetConfiguration(String groupName, String key) { - String oldValue = (String) properties.remove(groupName + "." + key); + unsetConfiguration(groupName, null, key); + } + + public void unsetConfiguration(String groupName, String profile, String key) + { + assert !key.startsWith(RSPROFILE_GROUP + "."); + String wholeKey = getWholeKey(groupName, profile, key); + String oldValue = (String) properties.remove(wholeKey); if (oldValue == null) { return; } - log.debug("Unsetting configuration value for {}.{}", groupName, key); + log.debug("Unsetting configuration value for {}", wholeKey); handler.invalidate(); synchronized (pendingChanges) { - pendingChanges.put(groupName + "." + key, null); + pendingChanges.put(wholeKey, null); } ConfigChanged configChanged = new ConfigChanged(); @@ -459,6 +612,17 @@ public class ConfigManager eventBus.post(configChanged); } + public void unsetRSProfileConfiguration(String groupName, String key) + { + String rsProfileKey = this.rsProfileKey; + if (rsProfileKey == null) + { + return; + } + + unsetConfiguration(groupName, rsProfileKey, key); + } + public ConfigDescriptor getConfigDescriptor(Config configurationProxy) { Class inter = configurationProxy.getClass().getInterfaces()[0]; @@ -656,6 +820,10 @@ public class ConfigManager { return Duration.ofMillis(Long.parseLong(str)); } + if (type == byte[].class) + { + return Base64.getUrlDecoder().decode(str); + } return str; } @@ -703,6 +871,10 @@ public class ConfigManager { return Long.toString(((Duration) object).toMillis()); } + if (object instanceof byte[]) + { + return Base64.getUrlEncoder().encodeToString((byte[]) object); + } return object == null ? null : object.toString(); } @@ -723,7 +895,7 @@ public class ConfigManager boolean changed; synchronized (pendingChanges) { - if (client != null) + if (configClient != null) { future = CompletableFuture.allOf(pendingChanges.entrySet().stream().map(entry -> { @@ -732,11 +904,11 @@ public class ConfigManager if (Strings.isNullOrEmpty(value)) { - return client.unset(key); + return configClient.unset(key); } else { - return client.set(key, value); + return configClient.set(key, value); } }).toArray(CompletableFuture[]::new)); } @@ -758,4 +930,250 @@ public class ConfigManager return future; } + + public List getRSProfiles() + { + String prefix = RSPROFILE_GROUP + "." + RSPROFILE_GROUP + "."; + Set profileKeys = new HashSet<>(); + for (Object oKey : properties.keySet()) + { + String key = (String) oKey; + if (!key.startsWith(prefix)) + { + continue; + } + + Matcher m = KEY_SPLITTER.matcher(key); + if (!m.find()) + { + continue; + } + + profileKeys.add(m.group(KEY_SPLITTER_PROFILE)); + } + + return profileKeys.stream() + .map(key -> + { + RuneScapeProfile prof = new RuneScapeProfile( + getConfiguration(RSPROFILE_GROUP, key, RSPROFILE_DISPLAY_NAME), + getConfiguration(RSPROFILE_GROUP, key, RSPROFILE_TYPE, RuneScapeProfileType.class), + getConfiguration(RSPROFILE_GROUP, key, RSPROFILE_LOGIN_HASH, byte[].class), + key + ); + + return prof; + }) + .collect(Collectors.toList()); + } + + private synchronized RuneScapeProfile findRSProfile(List profiles, String username, RuneScapeProfileType type, String displayName, boolean create) + { + byte[] salt = getConfiguration(RSPROFILE_GROUP, RSPROFILE_LOGIN_SALT, byte[].class); + if (salt == null) + { + salt = new byte[15]; + new SecureRandom() + .nextBytes(salt); + setConfiguration(RSPROFILE_GROUP, RSPROFILE_LOGIN_SALT, salt); + } + + Hasher h = Hashing.sha512().newHasher(); + h.putBytes(salt); + h.putString(username.toLowerCase(Locale.US), StandardCharsets.UTF_8); + byte[] loginHash = h.hash().asBytes(); + + Set matches = profiles.stream() + .filter(p -> Arrays.equals(p.getLoginHash(), loginHash) && p.getType() == type) + .collect(Collectors.toSet()); + + if (matches.size() > 1) + { + log.warn("multiple matching profiles"); + } + + if (matches.size() >= 1) + { + return matches.iterator().next(); + } + + if (!create) + { + return null; + } + + // generate the new key deterministically so if you "create" the same profile on 2 different clients it doesn't duplicate + Set keys = profiles.stream().map(RuneScapeProfile::getKey).collect(Collectors.toSet()); + byte[] key = Arrays.copyOf(loginHash, 6); + key[0] += type.ordinal(); + for (int i = 0; i < 0xFF; i++, key[1]++) + { + String keyStr = RSPROFILE_GROUP + "." + Base64.getUrlEncoder().encodeToString(key); + if (!keys.contains(keyStr)) + { + log.info("creating new profile {} for user {}", key, username); + + setConfiguration(RSPROFILE_GROUP, keyStr, RSPROFILE_LOGIN_HASH, loginHash); + setConfiguration(RSPROFILE_GROUP, keyStr, RSPROFILE_TYPE, type); + if (displayName != null) + { + setConfiguration(RSPROFILE_GROUP, keyStr, RSPROFILE_DISPLAY_NAME, displayName); + } + return new RuneScapeProfile(displayName, type, loginHash, keyStr); + } + } + throw new RuntimeException("too many rs profiles"); + } + + private void updateRSProfile() + { + if (client == null) + { + return; + } + + List profiles = getRSProfiles(); + RuneScapeProfile prof = findRSProfile(profiles, client.getUsername(), RuneScapeProfileType.getCurrent(client), null, false); + + String key = prof == null ? null : prof.getKey(); + if (Objects.equals(key, rsProfileKey)) + { + return; + } + rsProfileKey = key; + + eventBus.post(new RuneScapeProfileChanged()); + } + + @Subscribe + private void onUsernameChanged(UsernameChanged ev) + { + updateRSProfile(); + } + + @Subscribe + private void onWorldChanged(WorldChanged ev) + { + updateRSProfile(); + } + + @Subscribe + private void onPlayerChanged(PlayerChanged ev) + { + if (ev.getPlayer() == client.getLocalPlayer()) + { + String name = ev.getPlayer().getName(); + setRSProfileConfiguration(RSPROFILE_GROUP, RSPROFILE_DISPLAY_NAME, name); + } + } + + private synchronized void migrateConfig() + { + String migrationKey = "profileMigrationDone"; + if (getConfiguration("runelite", migrationKey) != null) + { + return; + } + + Map profiles = new HashMap<>(); + + AtomicInteger changes = new AtomicInteger(); + List> migrators = new ArrayList<>(); + for (String[] tpl : new String[][] + { + {"(grandexchange)\\.buylimit_(%)\\.(#)", "$1.buylimit.$3"}, + {"(timetracking)\\.(%)\\.(autoweed|contract)", "$1.$3"}, + {"(timetracking)\\.(%)\\.(#\\.#)", "$1.$3"}, + {"(timetracking)\\.(%)\\.(birdhouse)\\.(#)", "$1.$3.$4"}, + {"(killcount|personalbest)\\.(%)\\.([^.]+)", "$1.$3"}, + {"(geoffer)\\.(%)\\.(#)", "$1.$3"}, + }) + { + String replace = tpl[1]; + String pat = ("^" + tpl[0] + "$") + .replace("#", "-?[0-9]+") + .replace("(%)", "(?.*)"); + Pattern p = Pattern.compile(pat); + + migrators.add(oldkey -> + { + Matcher m = p.matcher(oldkey); + if (!m.find()) + { + return false; + } + + String newKey = m.replaceFirst(replace); + String username = m.group("login").toLowerCase(Locale.US); + + if (username.startsWith(RSPROFILE_GROUP + ".")) + { + return false; + } + + String profKey = profiles.computeIfAbsent(username, u -> + findRSProfile(getRSProfiles(), u, RuneScapeProfileType.STANDARD, u, true).getKey()); + + Matcher oldKeyM = KEY_SPLITTER.matcher(oldkey); + if (!oldKeyM.find()) + { + log.warn("skipping migration of invalid key \"{}\"", oldkey); + return false; + } + if (oldKeyM.group(KEY_SPLITTER_PROFILE) != null) + { + log.debug("skipping migrated key \"{}\"", oldkey); + return false; + } + + Matcher newKeyM = KEY_SPLITTER.matcher(newKey); + if (!newKeyM.find() || newKeyM.group(KEY_SPLITTER_PROFILE) != null) + { + log.warn("migration produced a bad key: \"{}\" -> \"{}\"", oldkey, newKey); + return false; + } + + if (changes.getAndAdd(1) <= 0) + { + File file = new File(propertiesFile.getParent(), propertiesFile.getName() + "." + TIME_FORMAT.format(new Date())); + log.info("backing up pre-migration config to {}", file); + try + { + saveToFile(file); + } + catch (IOException e) + { + log.error("Backup failed", e); + throw new RuntimeException(e); + } + } + + String oldGroup = oldKeyM.group(KEY_SPLITTER_GROUP); + String oldKeyPart = oldKeyM.group(KEY_SPLITTER_KEY); + String value = getConfiguration(oldGroup, oldKeyPart); + setConfiguration(newKeyM.group(KEY_SPLITTER_GROUP), profKey, newKeyM.group(KEY_SPLITTER_KEY), value); + unsetConfiguration(oldGroup, oldKeyPart); + return true; + }); + } + + Set keys = (Set) ImmutableSet.copyOf((Set) properties.keySet()); + keys: + for (String key : keys) + { + for (Predicate mig : migrators) + { + if (mig.test(key)) + { + continue keys; + } + } + } + + if (changes.get() > 0) + { + log.info("migrated {} config keys", changes); + } + setConfiguration("runelite", migrationKey, 1); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfile.java b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfile.java new file mode 100644 index 0000000000..f8f7d78310 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfile.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020 Abex + * 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.config; + +import lombok.Data; + +/** + * A profile/save of a OSRS account. Each account can 1 profile per {@link RuneScapeProfileType} + * (ie Standard/League/DMM}. + */ +@Data +public class RuneScapeProfile +{ + private final String displayName; + private final RuneScapeProfileType type; + private final byte[] loginHash; + + /** + * Profile key used to save configs for this profile to the config store. This will + * always start with {@link ConfigManager#RSPROFILE_GROUP} + */ + private final String key; +} diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java new file mode 100644 index 0000000000..f4cce1b590 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 Abex + * 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.config; + +import java.util.function.Predicate; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import net.runelite.api.Client; +import net.runelite.api.WorldType; + +@Getter +@RequiredArgsConstructor +public enum RuneScapeProfileType +{ + STANDARD(client -> true), + BETA(client -> client.getWorldType().contains(WorldType.TOURNAMENT)), + DEADMAN(client -> client.getWorldType().contains(WorldType.DEADMAN)), + TRAILBLAZER_LEAGUE(client -> client.getWorldType().contains(WorldType.LEAGUE)), + ; + + private final Predicate test; + + public static RuneScapeProfileType getCurrent(Client client) + { + RuneScapeProfileType[] types = values(); + for (int i = types.length - 1; i >= 0; i--) + { + RuneScapeProfileType type = types[i]; + if (types[i].test.test(client)) + { + return type; + } + } + + return STANDARD; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/events/ConfigChanged.java b/runelite-client/src/main/java/net/runelite/client/events/ConfigChanged.java index 75ebf5e96a..db79034c22 100644 --- a/runelite-client/src/main/java/net/runelite/client/events/ConfigChanged.java +++ b/runelite-client/src/main/java/net/runelite/client/events/ConfigChanged.java @@ -24,7 +24,9 @@ */ package net.runelite.client.events; +import javax.annotation.Nullable; import lombok.Data; +import net.runelite.client.config.RuneScapeProfile; /** * An event where a configuration entry has been modified. @@ -39,6 +41,14 @@ public class ConfigChanged * between other key values that may have the same name. */ private String group; + + /** + * The profile that has changed, if any + * + * @see RuneScapeProfile#getKey() + */ + @Nullable + private String profile; /** * The configuration key that has been modified. */ diff --git a/runelite-client/src/main/java/net/runelite/client/events/RuneScapeProfileChanged.java b/runelite-client/src/main/java/net/runelite/client/events/RuneScapeProfileChanged.java new file mode 100644 index 0000000000..9205fe0958 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/events/RuneScapeProfileChanged.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Abex + * 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.events; + +/** + * Posted when the user switches to a different RuneScape save profile + * This might be because they logged into a different account, or hopped + * to/from a Beta/Tournament/DMM/Leagues world + */ +public class RuneScapeProfileChanged +{ +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index c4c8f715cd..d35214805a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -230,27 +230,23 @@ public class ChatCommandsPlugin extends Plugin private void setKc(String boss, int killcount) { - configManager.setConfiguration("killcount." + client.getUsername().toLowerCase(), - boss.toLowerCase(), killcount); + configManager.setRSProfileConfiguration("killcount", boss.toLowerCase(), killcount); } private int getKc(String boss) { - Integer killCount = configManager.getConfiguration("killcount." + client.getUsername().toLowerCase(), - boss.toLowerCase(), int.class); + Integer killCount = configManager.getRSProfileConfiguration("killcount", boss.toLowerCase(), int.class); return killCount == null ? 0 : killCount; } private void setPb(String boss, int seconds) { - configManager.setConfiguration("personalbest." + client.getUsername().toLowerCase(), - boss.toLowerCase(), seconds); + configManager.setRSProfileConfiguration("personalbest", boss.toLowerCase(), seconds); } private int getPb(String boss) { - Integer personalBest = configManager.getConfiguration("personalbest." + client.getUsername().toLowerCase(), - boss.toLowerCase(), int.class); + Integer personalBest = configManager.getRSProfileConfiguration("personalbest", boss.toLowerCase(), int.class); return personalBest == null ? 0 : personalBest; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 1d5b9d9b46..240ea3b8d4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -125,7 +125,7 @@ public class GrandExchangePlugin extends Plugin private static final String OSB_GE_TEXT = "
OSBuddy Actively traded price: "; private static final String BUY_LIMIT_GE_TEXT = "
Buy limit: "; - private static final String BUY_LIMIT_KEY = "buylimit_"; + private static final String BUY_LIMIT_KEY = "buylimit"; private static final Gson GSON = new Gson(); private static final Duration BUY_LIMIT_RESET = Duration.ofHours(4); @@ -244,7 +244,7 @@ public class GrandExchangePlugin extends Plugin private SavedOffer getOffer(int slot) { - String offer = configManager.getConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); + String offer = configManager.getRSProfileConfiguration("geoffer", Integer.toString(slot)); if (offer == null) { return null; @@ -254,12 +254,12 @@ public class GrandExchangePlugin extends Plugin private void setOffer(int slot, SavedOffer offer) { - configManager.setConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot), GSON.toJson(offer)); + configManager.setRSProfileConfiguration("geoffer", Integer.toString(slot), GSON.toJson(offer)); } private void deleteOffer(int slot) { - configManager.unsetConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); + configManager.unsetRSProfileConfiguration("geoffer", Integer.toString(slot)); } @Provides @@ -782,20 +782,19 @@ public class GrandExchangePlugin extends Plugin private void setLimitResetTime(int itemId) { - Instant lastDateTime = configManager.getConfiguration(GrandExchangeConfig.CONFIG_GROUP, - BUY_LIMIT_KEY + client.getUsername().toLowerCase() + "." + itemId, Instant.class); + Instant lastDateTime = configManager.getRSProfileConfiguration(GrandExchangeConfig.CONFIG_GROUP, + BUY_LIMIT_KEY + "." + itemId, Instant.class); if (lastDateTime == null || lastDateTime.isBefore(Instant.now())) { - configManager.setConfiguration(GrandExchangeConfig.CONFIG_GROUP, - BUY_LIMIT_KEY + client.getUsername().toLowerCase() + "." + itemId, + configManager.setRSProfileConfiguration(GrandExchangeConfig.CONFIG_GROUP, BUY_LIMIT_KEY + "." + itemId, Instant.now().plus(BUY_LIMIT_RESET)); } } private Instant getLimitResetTime(int itemId) { - Instant lastDateTime = configManager.getConfiguration(GrandExchangeConfig.CONFIG_GROUP, - BUY_LIMIT_KEY + client.getUsername().toLowerCase() + "." + itemId, Instant.class); + Instant lastDateTime = configManager.getRSProfileConfiguration(GrandExchangeConfig.CONFIG_GROUP, + BUY_LIMIT_KEY + "." + itemId, Instant.class); if (lastDateTime == null) { return null; @@ -803,7 +802,7 @@ public class GrandExchangePlugin extends Plugin if (lastDateTime.isBefore(Instant.now())) { - configManager.unsetConfiguration(GrandExchangeConfig.CONFIG_GROUP, BUY_LIMIT_KEY + client.getUsername().toLowerCase() + "." + itemId); + configManager.unsetRSProfileConfiguration(GrandExchangeConfig.CONFIG_GROUP, BUY_LIMIT_KEY + "." + itemId); return null; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java index 93eef61337..55ff192afd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java @@ -40,11 +40,11 @@ import net.runelite.api.coords.WorldPoint; import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; -import net.runelite.api.events.UsernameChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.RuneScapeProfileChanged; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -216,7 +216,7 @@ public class TimeTrackingPlugin extends Plugin } @Subscribe - public void onUsernameChanged(UsernameChanged e) + public void onRuneScapeProfileChanged(RuneScapeProfileChanged e) { farmingTracker.loadCompletionTimes(); birdHouseTracker.loadFromConfig(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java index faad199b16..e2b411733f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java @@ -331,7 +331,7 @@ public class FarmingContractManager { try { - return Produce.getByItemID(Integer.parseInt(configManager.getConfiguration(getConfigGroup(), CONFIG_KEY_CONTRACT))); + return Produce.getByItemID(Integer.parseInt(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, CONFIG_KEY_CONTRACT))); } catch (NumberFormatException ignored) { @@ -343,17 +343,11 @@ public class FarmingContractManager { if (contract != null) { - configManager.setConfiguration(getConfigGroup(), CONFIG_KEY_CONTRACT, String.valueOf(contract.getItemID())); + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, CONFIG_KEY_CONTRACT, String.valueOf(contract.getItemID())); } else { - configManager.unsetConfiguration(getConfigGroup(), CONFIG_KEY_CONTRACT); + configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, CONFIG_KEY_CONTRACT); } } - - @Nonnull - private String getConfigGroup() - { - return TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername(); - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java index 16ae00c136..192a4d5ab5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java @@ -83,11 +83,10 @@ public class FarmingTracker boolean changed = false; { - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername(); String autoweed = Integer.toString(client.getVar(Varbits.AUTOWEED)); - if (!autoweed.equals(configManager.getConfiguration(group, TimeTrackingConfig.AUTOWEED))) + if (!autoweed.equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED))) { - configManager.setConfiguration(group, TimeTrackingConfig.AUTOWEED, autoweed); + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED, autoweed); changed = true; } } @@ -100,16 +99,15 @@ public class FarmingTracker } // Write config with new varbits - // timetracking...=: - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + region.getRegionID(); + // timetracking...=: long unixNow = Instant.now().getEpochSecond(); for (FarmingPatch patch : region.getPatches()) { // Write the config value if it doesn't match what is current, or it is more than 5 minutes old Varbits varbit = patch.getVarbit(); - String key = Integer.toString(varbit.getId()); + String key = region.getRegionID() + "." + varbit.getId(); String strVarbit = Integer.toString(client.getVar(varbit)); - String storedValue = configManager.getConfiguration(group, key); + String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key); if (storedValue != null) { @@ -133,7 +131,7 @@ public class FarmingTracker } String value = strVarbit + ":" + unixNow; - configManager.setConfiguration(group, key, value); + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key, value); changed = true; } } @@ -151,16 +149,11 @@ public class FarmingTracker { long unixNow = Instant.now().getEpochSecond(); - boolean autoweed; - { - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername(); - autoweed = Integer.toString(Autoweed.ON.ordinal()) - .equals(configManager.getConfiguration(group, TimeTrackingConfig.AUTOWEED)); - } + boolean autoweed = Integer.toString(Autoweed.ON.ordinal()) + .equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED)); - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + patch.getRegion().getRegionID(); - String key = Integer.toString(patch.getVarbit().getId()); - String storedValue = configManager.getConfiguration(group, key); + String key = patch.getRegion().getRegionID() + "." + patch.getVarbit().getId(); + String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key); if (storedValue == null) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java index c61b952cee..f0d0e33517 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java @@ -91,12 +91,10 @@ public class BirdHouseTracker { birdHouseData.clear(); - final String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + TimeTrackingConfig.BIRD_HOUSE; - for (BirdHouseSpace space : BirdHouseSpace.values()) { - String key = Integer.toString(space.getVarp().getId()); - String storedValue = configManager.getConfiguration(group, key); + String key = TimeTrackingConfig.BIRD_HOUSE + "." + space.getVarp().getId(); + String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key); if (storedValue != null) { @@ -242,12 +240,10 @@ public class BirdHouseTracker private void saveToConfig(Map updatedData) { - final String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + TimeTrackingConfig.BIRD_HOUSE; - for (BirdHouseData data : updatedData.values()) { - String key = Integer.toString(data.getSpace().getVarp().getId()); - configManager.setConfiguration(group, key, data.getVarp() + ":" + data.getTimestamp()); + String key = TimeTrackingConfig.BIRD_HOUSE + "." + data.getSpace().getVarp().getId(); + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key, data.getVarp() + ":" + data.getTimestamp()); } } } diff --git a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java index 208e90b699..9c9fd79871 100644 --- a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java @@ -32,8 +32,10 @@ import java.io.IOException; import java.time.Instant; import java.util.UUID; import java.util.concurrent.ScheduledExecutorService; +import java.util.regex.Matcher; import javax.inject.Inject; import javax.inject.Named; +import net.runelite.api.Client; import net.runelite.client.RuneLite; import net.runelite.client.account.AccountSession; import net.runelite.client.eventbus.EventBus; @@ -67,6 +69,10 @@ public class ConfigManagerTest @Named("config") File config = RuneLite.DEFAULT_CONFIG_FILE; + @Mock + @Bind + Client client; + @Inject ConfigManager manager; @@ -132,4 +138,26 @@ public class ConfigManagerTest manager.setDefaultConfiguration(conf, false); Assert.assertNull(conf.nullDefaultKey()); } + + @Test + public void testKeySplitter() + { + for (String[] test : new String[][] + { + {"rsprofile", "rsprofile.123", "rsprofileThing"}, + {"rsprofile", null, "rsprofileThing"}, + {"foo", "rsprofile.123", "big.bad"}, + {"foo", null, "big.bad"}, + {"foo", "rsprofile.123", "456"}, + {"foo", null, "file.256"}, + }) + { + String whole = ConfigManager.getWholeKey(test[0], test[1], test[2]); + Matcher m = ConfigManager.KEY_SPLITTER.matcher(whole); + Assert.assertTrue(m.find()); + Assert.assertEquals(m.group(1), test[0]); + Assert.assertEquals(m.group(2), test[1]); + Assert.assertEquals(m.group(3), test[2]); + } + } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 7bdf59971c..0145df8777 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -124,8 +124,6 @@ public class ChatCommandsPluginTest Player player = mock(Player.class); when(player.getName()).thenReturn(PLAYER_NAME); when(client.getLocalPlayer()).thenReturn(player); - - when(client.getUsername()).thenReturn(PLAYER_NAME); } @Test @@ -151,7 +149,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Corporeal Beast kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "corporeal beast", 4); + verify(configManager).setRSProfileConfiguration("killcount", "corporeal beast", 4); } @Test @@ -163,8 +161,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "theatre of blood", 73); - verify(configManager).setConfiguration("personalbest.adam", "theatre of blood", 37 * 60 + 4); + verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73); + verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 37 * 60 + 4); } @Test @@ -176,14 +174,14 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "theatre of blood", 73); - verify(configManager).setConfiguration("personalbest.adam", "theatre of blood", 37 * 60 + 4); + verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73); + verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 37 * 60 + 4); } @Test public void testTheatreOfBloodNoPB() { - when(configManager.getConfiguration("personalbest.adam", "theatre of blood", int.class)).thenReturn(37 * 60 + 4); // 37:04 + when(configManager.getRSProfileConfiguration("personalbest", "theatre of blood", int.class)).thenReturn(37 * 60 + 4); // 37:04 ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Wave 'The Final Challenge' complete! Duration: 5:04
Theatre of Blood wave completion time: 38:17
Personal best: 37:10", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -191,8 +189,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "theatre of blood", 73); - verify(configManager, never()).setConfiguration(eq("personalbest.adam"), eq("theatre of blood"), anyInt()); + verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73); + verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("theatre of blood"), anyInt()); } @Test @@ -201,7 +199,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your subdued Wintertodt count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "wintertodt", 4); + verify(configManager).setRSProfileConfiguration("killcount", "wintertodt", 4); } @Test @@ -210,7 +208,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Kree'arra kill count is: 4.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "kree'arra", 4); + verify(configManager).setRSProfileConfiguration("killcount", "kree'arra", 4); } @Test @@ -219,7 +217,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Barrows chest count is: 277.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "barrows chests", 277); + verify(configManager).setRSProfileConfiguration("killcount", "barrows chests", 277); } @Test @@ -228,7 +226,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your herbiboar harvest count is: 4091.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "herbiboar", 4091); + verify(configManager).setRSProfileConfiguration("killcount", "herbiboar", 4091); } @Test @@ -237,7 +235,7 @@ public class ChatCommandsPluginTest ChatMessage gauntletMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 123.", null, 0); chatCommandsPlugin.onChatMessage(gauntletMessage); - verify(configManager).setConfiguration("killcount.adam", "gauntlet", 123); + verify(configManager).setRSProfileConfiguration("killcount", "gauntlet", 123); } @Test @@ -246,7 +244,7 @@ public class ChatCommandsPluginTest ChatMessage corruptedGauntletMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Corrupted Gauntlet completion count is: 4729.", null, 0); chatCommandsPlugin.onChatMessage(corruptedGauntletMessage); - verify(configManager).setConfiguration("killcount.adam", "corrupted gauntlet", 4729); + verify(configManager).setRSProfileConfiguration("killcount", "corrupted gauntlet", 4729); } @Test @@ -261,7 +259,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(79)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("kree'arra"), eq(79)); } @Test @@ -276,7 +274,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(55)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(55)); } @Test @@ -291,7 +289,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("kree'arra"), eq(181)); } @Test @@ -300,8 +298,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27); - verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1); + verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 27); + verify(configManager).setRSProfileConfiguration("killcount", "duel arena win streak", 1); } @Test @@ -310,7 +308,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22); + verify(configManager).setRSProfileConfiguration("killcount", "duel arena wins", 22); } @Test @@ -319,7 +317,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0); chatCommandsPlugin.onChatMessage(chatMessageEvent); - verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999); + verify(configManager).setRSProfileConfiguration("killcount", "duel arena losses", 999); } @Test @@ -334,8 +332,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("prifddinas agility course"), eq(61)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("prifddinas agility course"), eq(2)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("prifddinas agility course"), eq(61)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("prifddinas agility course"), eq(2)); } @Test @@ -347,8 +345,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 104:31 (new personal best)", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(104 * 60 + 31)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(2)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tzkal-zuk"), eq(104 * 60 + 31)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tzkal-zuk"), eq(2)); } @Test @@ -360,8 +358,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 172:18. Personal best: 134:52", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(134 * 60 + 52)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(3)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tzkal-zuk"), eq(134 * 60 + 52)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tzkal-zuk"), eq(3)); } @Test @@ -373,8 +371,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 179.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(96)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(179)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(96)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("grotesque guardians"), eq(179)); } @Test @@ -386,8 +384,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 32.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(2 * 60 + 14)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(32)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(2 * 60 + 14)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("grotesque guardians"), eq(32)); } @Test @@ -399,8 +397,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(7 * 60 + 59)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("gauntlet"), eq(124)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("gauntlet"), eq(7 * 60 + 59)); } @Test @@ -412,8 +410,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(10 * 60 + 24)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("gauntlet"), eq(10 * 60 + 24)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("gauntlet"), eq(124)); } @Test @@ -425,14 +423,14 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 51.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("chambers of xeric"), eq(51)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(37 * 60 + 4)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("chambers of xeric"), eq(51)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(37 * 60 + 4)); } @Test public void testCoXKillUnknownPb() { - when(configManager.getConfiguration("personalbest.adam", "chambers of xeric", int.class)).thenReturn(25 * 60 + 14); + when(configManager.getRSProfileConfiguration("personalbest", "chambers of xeric", int.class)).thenReturn(25 * 60 + 14); ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 11-15 players Duration: 23:25 Personal best: 20:19", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -440,14 +438,14 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("killcount.adam", "chambers of xeric", 52); - verify(configManager).setConfiguration("personalbest.adam", "chambers of xeric", 20 * 60 + 19); + verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 52); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 20 * 60 + 19); } @Test public void testCoXKillNoPb() { - when(configManager.getConfiguration(anyString(), anyString(), any())).thenReturn(2224); + when(configManager.getRSProfileConfiguration(anyString(), anyString(), any(Class.class))).thenReturn(2224); ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 3 players Duration: 37:10 (new personal best)", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -455,8 +453,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("chambers of xeric"), eq(52)); - verify(configManager, never()).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), anyInt()); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("chambers of xeric"), eq(52)); + verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), anyInt()); } @Test @@ -467,7 +465,7 @@ public class ChatCommandsPluginTest when(advLogWidget.getChild(ChatCommandsPlugin.ADV_LOG_EXPLOITS_TEXT_INDEX)).thenReturn(advLogExploitsTextWidget); when(advLogExploitsTextWidget.getText()).thenReturn("The Exploits of " + PLAYER_NAME); when(client.getWidget(WidgetInfo.ADVENTURE_LOG)).thenReturn(advLogWidget); - when(configManager.getConfiguration(anyString(), anyString(), any())).thenReturn(2224); + when(configManager.getRSProfileConfiguration(anyString(), anyString(), any(Class.class))).thenReturn(2224); WidgetLoaded advLogEvent = new WidgetLoaded(); advLogEvent.setGroupId(ADVENTURE_LOG_ID); @@ -502,14 +500,14 @@ public class ChatCommandsPluginTest chatCommandsPlugin.onWidgetLoaded(countersLogEvent); chatCommandsPlugin.onGameTick(new GameTick()); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tztok-jad"), eq(38 * 60 + 10)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(5 * 60 + 48)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("vorkath"), eq(1 * 60 + 21)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(2 * 60 + 49)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("hespori"), eq(57)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("nightmare"), eq(3 * 60 + 30)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(24 * 60 + 17)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric challenge mode"), eq(22 * 60 + 15)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(38 * 60 + 10)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(5 * 60 + 48)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("vorkath"), eq(1 * 60 + 21)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(2 * 60 + 49)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("hespori"), eq(57)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("nightmare"), eq(3 * 60 + 30)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(24 * 60 + 17)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric challenge mode"), eq(22 * 60 + 15)); } @Test @@ -554,12 +552,12 @@ public class ChatCommandsPluginTest chatCommandsPlugin.onWidgetLoaded(countersLogEvent); chatCommandsPlugin.onGameTick(new GameTick()); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tztok-jad"), eq(65 * 60 + 12)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(2 * 60 + 55)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("vorkath"), eq(1 * 60 + 37)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("hespori"), eq(1 * 60 + 42)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(21 * 60 + 23)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric challenge mode"), eq(21 * 60 + 26)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(65 * 60 + 12)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(2 * 60 + 55)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("vorkath"), eq(1 * 60 + 37)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("hespori"), eq(1 * 60 + 42)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(21 * 60 + 23)); + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric challenge mode"), eq(21 * 60 + 26)); } @Test @@ -612,7 +610,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 1 time: 1:19. Personal best: 0:28", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 1", 28); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 1", 28); } @Test @@ -621,7 +619,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 2 time: 0:47 (new personal best)", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 2", 47); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 2", 47); } @Test @@ -630,8 +628,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 5 time: 4:46 (new personal best)
Overall time: 9:53 (new personal best)
", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 5", 4 * 60 + 46); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre", 9 * 60 + 53); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 5", 4 * 60 + 46); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre", 9 * 60 + 53); } @Test @@ -640,8 +638,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 5 time: 3:26 (new personal best)
Overall time: 9:17. Personal best: 9:15
", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 5", 3 * 60 + 26); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre", 9 * 60 + 15); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 5", 3 * 60 + 26); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre", 9 * 60 + 15); } @Test @@ -650,8 +648,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 5 time: 3:56. Personal best: 3:05
Overall time: 9:14. Personal best: 7:49
", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 5", 3 * 60 + 5); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre", 7 * 60 + 49); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 5", 3 * 60 + 5); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre", 7 * 60 + 49); } @Test @@ -660,8 +658,8 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Floor 5 time: 3:10. Personal best: 3:04
Overall time: 7:47 (new personal best)
", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre floor 5", 3 * 60 + 4); - verify(configManager).setConfiguration("personalbest.adam", "hallowed sepulchre", 7 * 60 + 47); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre floor 5", 3 * 60 + 4); + verify(configManager).setRSProfileConfiguration("personalbest", "hallowed sepulchre", 7 * 60 + 47); } @Test @@ -670,7 +668,7 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have completed Floor 5 of the Hallowed Sepulchre! Total completions: 81.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("killcount.adam", "hallowed sepulchre floor 5", 81); + verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre floor 5", 81); } @Test @@ -679,6 +677,6 @@ public class ChatCommandsPluginTest ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "You have opened the Grand Hallowed Coffin 36 times!", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setConfiguration("killcount.adam", "hallowed sepulchre", 36); + verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre", 36); } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java index 9eb1f22342..71db8a25db 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java @@ -125,7 +125,6 @@ public class GrandExchangePluginTest public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - when(client.getUsername()).thenReturn("adam"); when(client.getWorldType()).thenReturn(EnumSet.noneOf(WorldType.class)); } @@ -148,7 +147,7 @@ public class GrandExchangePluginTest savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); - when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); + when(configManager.getRSProfileConfiguration("geoffer", "0")).thenReturn(GSON.toJson(savedOffer)); // buy 2 @ 10/ea GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); @@ -182,7 +181,7 @@ public class GrandExchangePluginTest savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); - when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); + when(configManager.getRSProfileConfiguration("geoffer", "0")).thenReturn(GSON.toJson(savedOffer)); GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); when(grandExchangeOffer.getQuantitySold()).thenReturn(1); @@ -206,7 +205,7 @@ public class GrandExchangePluginTest savedOffer.setPrice(1000); savedOffer.setSpent(25); savedOffer.setState(GrandExchangeOfferState.BUYING); - when(configManager.getConfiguration("geoffer.adam", "0")).thenReturn(GSON.toJson(savedOffer)); + when(configManager.getRSProfileConfiguration("geoffer", "0")).thenReturn(GSON.toJson(savedOffer)); GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); when(grandExchangeOffer.getQuantitySold()).thenReturn(1); @@ -242,6 +241,6 @@ public class GrandExchangePluginTest grandExchangePlugin.onGrandExchangeOfferChanged(grandExchangeOfferChanged); - verify(configManager, never()).unsetConfiguration(anyString(), anyString()); + verify(configManager, never()).unsetRSProfileConfiguration(anyString(), anyString()); } } \ No newline at end of file From 4309dcd53e3d16a3cae961e2c399bd5a0904181d Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 23 Nov 2020 00:12:56 -0700 Subject: [PATCH 015/173] ConfigManager: immediately send config after importing local --- .../java/net/runelite/client/config/ConfigManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index c86df2d2b2..64c1fa14b7 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -313,12 +313,12 @@ public class ConfigManager migrateConfig(); } - public void importLocal() + public Future importLocal() { if (session == null) { // No session, no import - return; + return null; } final File file = new File(propertiesFile.getParent(), propertiesFile.getName() + "." + TIME_FORMAT.format(new Date())); @@ -330,10 +330,12 @@ public class ConfigManager catch (IOException e) { log.warn("Backup failed, skipping import", e); - return; + return null; } syncPropertiesFromFile(getLocalPropertiesFile()); + + return sendConfig(); } private synchronized void loadFromFile() From e769ee0a7b363d1f0f46f9767aae4693991cc80f Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 23 Nov 2020 00:14:55 -0700 Subject: [PATCH 016/173] http-api, http-service, rl-client: bulk upload configuration changes --- .../http/api/config/ConfigClient.java | 55 +++++++++++ .../runelite/http/api/config/ConfigEntry.java | 27 ++---- .../http/api/config/Configuration.java | 14 +-- .../http/service/config/ConfigController.java | 25 +++++ .../http/service/config/ConfigService.java | 91 ++++++++++++++----- .../runelite/client/config/ConfigManager.java | 40 ++++---- 6 files changed, 175 insertions(+), 77 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java b/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java index 334660fb85..b66b802399 100644 --- a/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java +++ b/http-api/src/main/java/net/runelite/http/api/config/ConfigClient.java @@ -24,6 +24,7 @@ */ package net.runelite.http.api.config; +import com.google.gson.Gson; import com.google.gson.JsonParseException; import java.io.IOException; import java.io.InputStream; @@ -48,6 +49,7 @@ import okhttp3.Response; public class ConfigClient { private static final MediaType TEXT_PLAIN = MediaType.parse("text/plain"); + private static final Gson GSON = RuneLiteAPI.GSON; private final OkHttpClient client; private final UUID uuid; @@ -114,6 +116,59 @@ public class ConfigClient return future; } + public CompletableFuture patch(Configuration configuration) + { + CompletableFuture future = new CompletableFuture<>(); + + HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() + .addPathSegment("config") + .build(); + + log.debug("Built URI: {}", url); + + Request request = new Request.Builder() + .patch(RequestBody.create(RuneLiteAPI.JSON, GSON.toJson(configuration))) + .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) + .url(url) + .build(); + + client.newCall(request).enqueue(new Callback() + { + @Override + public void onFailure(Call call, IOException e) + { + log.warn("Unable to synchronize configuration item", e); + future.completeExceptionally(e); + } + + @Override + public void onResponse(Call call, Response response) + { + if (response.code() != 200) + { + String body = "bad response"; + try + { + body = response.body().string(); + } + catch (IOException ignored) + { + } + + log.warn("failed to synchronize some of {} configuration values: {}", configuration.getConfig().size(), body); + } + else + { + log.debug("Synchronized {} configuration values", configuration.getConfig().size()); + } + response.close(); + future.complete(null); + } + }); + + return future; + } + public CompletableFuture unset(String key) { CompletableFuture future = new CompletableFuture<>(); diff --git a/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java b/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java index 783d68361e..d8b69dae72 100644 --- a/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java +++ b/http-api/src/main/java/net/runelite/http/api/config/ConfigEntry.java @@ -24,28 +24,15 @@ */ package net.runelite.http.api.config; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor public class ConfigEntry { private String key; private String value; - - public String getKey() - { - return key; - } - - public void setKey(String key) - { - this.key = key; - } - - public String getValue() - { - return value; - } - - public void setValue(String value) - { - this.value = value; - } } diff --git a/http-api/src/main/java/net/runelite/http/api/config/Configuration.java b/http-api/src/main/java/net/runelite/http/api/config/Configuration.java index 7b256e0c7a..44269b735a 100644 --- a/http-api/src/main/java/net/runelite/http/api/config/Configuration.java +++ b/http-api/src/main/java/net/runelite/http/api/config/Configuration.java @@ -26,18 +26,12 @@ package net.runelite.http.api.config; import java.util.ArrayList; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +@Data +@AllArgsConstructor public class Configuration { private List config = new ArrayList<>(); - - public Configuration(List config) - { - this.config = config; - } - - public List getConfig() - { - return config; - } } diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java index 971094a585..c247ecc0bc 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigController.java @@ -25,6 +25,7 @@ package net.runelite.http.service.config; import java.io.IOException; +import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.runelite.http.api.config.Configuration; @@ -32,6 +33,7 @@ import net.runelite.http.service.account.AuthFilter; import net.runelite.http.service.account.beans.SessionEntry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -66,6 +68,29 @@ public class ConfigController return configService.get(session.getUser()); } + @PatchMapping + public List patch( + HttpServletRequest request, + HttpServletResponse response, + @RequestBody Configuration changes + ) throws IOException + { + SessionEntry session = authFilter.handle(request, response); + if (session == null) + { + return null; + } + + List failures = configService.patch(session.getUser(), changes); + if (failures.size() != 0) + { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + return failures; + } + + return null; + } + @RequestMapping(path = "/{key:.+}", method = PUT) public void setKey( HttpServletRequest request, diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index 727620570f..7c3f5c37b3 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -25,6 +25,7 @@ package net.runelite.http.service.config; import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Strings; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -38,6 +39,7 @@ import static com.mongodb.client.model.Filters.eq; import com.mongodb.client.model.IndexOptions; import com.mongodb.client.model.Indexes; import com.mongodb.client.model.UpdateOptions; +import static com.mongodb.client.model.Updates.combine; import static com.mongodb.client.model.Updates.set; import static com.mongodb.client.model.Updates.unset; import java.util.ArrayList; @@ -50,6 +52,7 @@ import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.config.ConfigEntry; import net.runelite.http.api.config.Configuration; import org.bson.Document; +import org.bson.conversions.Bson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -131,31 +134,79 @@ public class ConfigService return new Configuration(config); } + public List patch(int userID, Configuration config) + { + List failures = new ArrayList<>(); + List sets = new ArrayList<>(config.getConfig().size()); + for (ConfigEntry entry : config.getConfig()) + { + Bson s = setForKV(entry.getKey(), entry.getValue()); + if (s == null) + { + failures.add(entry.getKey()); + } + else + { + sets.add(s); + } + } + + if (sets.size() > 0) + { + mongoCollection.updateOne( + eq("_userId", userID), + combine(sets), + upsertUpdateOptions + ); + } + + return failures; + } + + @Nullable + private Bson setForKV(String key, @Nullable String value) + { + if (key.startsWith("$") || key.startsWith("_")) + { + return null; + } + + String[] split = key.split("\\.", 2); + if (split.length != 2) + { + return null; + } + + String dbKey = split[0] + "." + split[1].replace('.', ':'); + + if (Strings.isNullOrEmpty(value)) + { + return unset(dbKey); + } + + if (!validateJson(value)) + { + return null; + } + + Object jsonValue = parseJsonString(value); + return set(dbKey, jsonValue); + } + public boolean setKey( int userId, String key, @Nullable String value ) { - if (key.startsWith("$") || key.startsWith("_")) + Bson set = setForKV(key, value); + if (set == null) { return false; } - String[] split = key.split("\\.", 2); - if (split.length != 2) - { - return false; - } - - if (!validateJson(value)) - { - return false; - } - - Object jsonValue = parseJsonString(value); mongoCollection.updateOne(eq("_userId", userId), - set(split[0] + "." + split[1].replace('.', ':'), jsonValue), + set, upsertUpdateOptions); return true; } @@ -165,19 +216,13 @@ public class ConfigService String key ) { - if (key.startsWith("$") || key.startsWith("_")) + Bson set = setForKV(key, null); + if (set == null) { return false; } - String[] split = key.split("\\.", 2); - if (split.length != 2) - { - return false; - } - - mongoCollection.updateOne(eq("_userId", userId), - unset(split[0] + "." + split[1].replace('.', ':'))); + mongoCollection.updateOne(eq("_userId", userId), set); return true; } diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 64c1fa14b7..3ef6744b54 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -894,40 +894,32 @@ public class ConfigManager private CompletableFuture sendConfig() { CompletableFuture future = null; - boolean changed; synchronized (pendingChanges) { + if (pendingChanges.isEmpty()) + { + return null; + } + if (configClient != null) { - future = CompletableFuture.allOf(pendingChanges.entrySet().stream().map(entry -> - { - String key = entry.getKey(); - String value = entry.getValue(); + Configuration patch = new Configuration(pendingChanges.entrySet().stream() + .map(e -> new ConfigEntry(e.getKey(), e.getValue())) + .collect(Collectors.toList())); - if (Strings.isNullOrEmpty(value)) - { - return configClient.unset(key); - } - else - { - return configClient.set(key, value); - } - }).toArray(CompletableFuture[]::new)); + future = configClient.patch(patch); } - changed = !pendingChanges.isEmpty(); + pendingChanges.clear(); } - if (changed) + try { - try - { - saveToFile(propertiesFile); - } - catch (IOException ex) - { - log.warn("unable to save configuration file", ex); - } + saveToFile(propertiesFile); + } + catch (IOException ex) + { + log.warn("unable to save configuration file", ex); } return future; From e3ff5dd487172eed6601bc4a7bbebb209ba4de3f Mon Sep 17 00:00:00 2001 From: Ron Young Date: Wed, 28 Oct 2020 07:12:09 -0500 Subject: [PATCH 017/173] runelite-api: import SpritePixels methods --- .../java/net/runelite/api/SpritePixels.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/SpritePixels.java b/runelite-api/src/main/java/net/runelite/api/SpritePixels.java index 4ebdbdba1c..c5e99a6432 100644 --- a/runelite-api/src/main/java/net/runelite/api/SpritePixels.java +++ b/runelite-api/src/main/java/net/runelite/api/SpritePixels.java @@ -56,6 +56,62 @@ public interface SpritePixels */ int getHeight(); + /** + * Gets the max width of the sprite image in pixels. + * + * @return the width + */ + int getMaxWidth(); + + /** + * Gets the max height of the sprite image in pixels. + * + * @return the height + */ + int getMaxHeight(); + + /** + * Gets the x offset of the sprite image in pixels. + * + * @return the offset + */ + int getOffsetX(); + + /** + * Gets the y offset of the sprite image in pixels. + * + * @return the offset + */ + int getOffsetY(); + + /** + * Sets the max width of the sprite image in pixels. + * + * @param maxWidth the width + */ + void setMaxWidth(int maxWidth); + + /** + * Sets the max height of the sprite image in pixels. + * + * @param maxHeight the height + */ + void setMaxHeight(int maxHeight); + + /** + * Sets the x offset of the sprite image in pixels. + * + * @param offsetX the offset + */ + void setOffsetX(int offsetX); + + /** + * Sets the y offset of the sprite image in pixels. + * + * @param offsetY the offset + */ + void setOffsetY(int offsetY); + /** * Gets an array of all pixels data in the sprite. * From 80b086a975990f9e97775e0bd8aa90360c786d11 Mon Sep 17 00:00:00 2001 From: SirGirion Date: Thu, 29 Oct 2020 08:33:07 -0400 Subject: [PATCH 018/173] itemcharges: add cox potions to show item doses --- .../plugins/itemcharges/ItemWithCharge.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java index 2ce93881bb..b9c1124423 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java @@ -435,6 +435,90 @@ enum ItemWithCharge ZAMORAK_BR2(POTION, ZAMORAK_BREW2, 2), ZAMORAK_BR3(POTION, ZAMORAK_BREW3, 3), ZAMORAK_BR4(POTION, ZAMORAK_BREW4, 4), + ELDER_MIN1(POTION, ELDER_1, 1), + ELDER_MIN2(POTION, ELDER_2, 2), + ELDER_MIN3(POTION, ELDER_3, 3), + ELDER_MIN4(POTION, ELDER_4, 4), + ELDER1(POTION, ELDER_POTION_1, 1), + ELDER2(POTION, ELDER_POTION_2, 2), + ELDER3(POTION, ELDER_POTION_3, 3), + ELDER4(POTION, ELDER_POTION_4, 4), + ELDER_MAX1(POTION, ELDER_1_20921, 1), + ELDER_MAX2(POTION, ELDER_2_20922, 2), + ELDER_MAX3(POTION, ELDER_3_20923, 3), + ELDER_MAX4(POTION, ELDER_4_20924, 4), + KODAI_MIN1(POTION, KODAI_1, 1), + KODAI_MIN2(POTION, KODAI_2, 2), + KODAI_MIN3(POTION, KODAI_3, 3), + KODAI_MIN4(POTION, KODAI_4, 4), + KODAI1(POTION, KODAI_POTION_1, 1), + KODAI2(POTION, KODAI_POTION_2, 2), + KODAI3(POTION, KODAI_POTION_3, 3), + KODAI4(POTION, KODAI_POTION_4, 4), + KODAI_MAX1(POTION, KODAI_1_20945, 1), + KODAI_MAX2(POTION, KODAI_2_20946, 2), + KODAI_MAX3(POTION, KODAI_3_20947, 3), + KODAI_MAX4(POTION, KODAI_4_20948, 4), + TWISTED_MIN1(POTION, TWISTED_1, 1), + TWISTED_MIN2(POTION, TWISTED_2, 2), + TWISTED_MIN3(POTION, TWISTED_3, 3), + TWISTED_MIN4(POTION, TWISTED_4, 4), + TWISTED1(POTION, TWISTED_POTION_1, 1), + TWISTED2(POTION, TWISTED_POTION_2, 2), + TWISTED3(POTION, TWISTED_POTION_3, 3), + TWISTED4(POTION, TWISTED_POTION_4, 4), + TWISTED_MAX1(POTION, TWISTED_1_20933, 1), + TWISTED_MAX2(POTION, TWISTED_2_20934, 2), + TWISTED_MAX3(POTION, TWISTED_3_20935, 3), + TWISTED_MAX4(POTION, TWISTED_4_20936, 4), + REVITALISATION_MIN1(POTION, REVITALISATION_1, 1), + REVITALISATION_MIN2(POTION, REVITALISATION_2, 2), + REVITALISATION_MIN3(POTION, REVITALISATION_3, 3), + REVITALISATION_MIN4(POTION, REVITALISATION_4, 4), + REVITALISATION1(POTION, REVITALISATION_POTION_1, 1), + REVITALISATION2(POTION, REVITALISATION_POTION_2, 2), + REVITALISATION3(POTION, REVITALISATION_POTION_3, 3), + REVITALISATION4(POTION, REVITALISATION_POTION_4, 4), + REVITALISATION_MAX1(POTION, REVITALISATION_1_20957, 1), + REVITALISATION_MAX2(POTION, REVITALISATION_2_20958, 2), + REVITALISATION_MAX3(POTION, REVITALISATION_3_20959, 3), + REVITALISATION_MAX4(POTION, REVITALISATION_4_20960, 4), + XERICS_AID_MIN1(POTION, XERICS_AID_1, 1), + XERICS_AID_MIN2(POTION, XERICS_AID_2, 2), + XERICS_AID_MIN3(POTION, XERICS_AID_3, 3), + XERICS_AID_MIN4(POTION, XERICS_AID_4, 4), + XERICS_AID1(POTION, XERICS_AID_1_20977, 1), + XERICS_AID2(POTION, XERICS_AID_2_20978, 2), + XERICS_AID3(POTION, XERICS_AID_3_20979, 3), + XERICS_AID4(POTION, XERICS_AID_4_20980, 4), + XERICS_AID_MAX1(POTION, XERICS_AID_1_20981, 1), + XERICS_AID_MAX2(POTION, XERICS_AID_2_20982, 2), + XERICS_AID_MAX3(POTION, XERICS_AID_3_20983, 3), + XERICS_AID_MAX4(POTION, XERICS_AID_4_20984, 4), + PRAYER_ENHANCE_MIN1(POTION, PRAYER_ENHANCE_1, 1), + PRAYER_ENHANCE_MIN2(POTION, PRAYER_ENHANCE_2, 2), + PRAYER_ENHANCE_MIN3(POTION, PRAYER_ENHANCE_3, 3), + PRAYER_ENHANCE_MIN4(POTION, PRAYER_ENHANCE_4, 4), + PRAYER_ENHANCE1(POTION, PRAYER_ENHANCE_1_20965, 1), + PRAYER_ENHANCE2(POTION, PRAYER_ENHANCE_2_20966, 2), + PRAYER_ENHANCE3(POTION, PRAYER_ENHANCE_3_20967, 3), + PRAYER_ENHANCE4(POTION, PRAYER_ENHANCE_4_20968, 4), + PRAYER_ENHANCE_MAX1(POTION, PRAYER_ENHANCE_1_20969, 1), + PRAYER_ENHANCE_MAX2(POTION, PRAYER_ENHANCE_2_20970, 2), + PRAYER_ENHANCE_MAX3(POTION, PRAYER_ENHANCE_3_20971, 3), + PRAYER_ENHANCE_MAX4(POTION, PRAYER_ENHANCE_4_20972, 4), + COX_OVERLOAD_MIN1(POTION, OVERLOAD_1_20985, 1), + COX_OVERLOAD_MIN2(POTION, OVERLOAD_2_20986, 2), + COX_OVERLOAD_MIN3(POTION, OVERLOAD_3_20987, 3), + COX_OVERLOAD_MIN4(POTION, OVERLOAD_4_20988, 4), + COX_OVERLOAD1(POTION, OVERLOAD_1_20989, 1), + COX_OVERLOAD2(POTION, OVERLOAD_2_20990, 2), + COX_OVERLOAD3(POTION, OVERLOAD_3_20991, 3), + COX_OVERLOAD4(POTION, OVERLOAD_4_20992, 4), + COX_OVERLOAD_MAX1(POTION, OVERLOAD_1_20993, 1), + COX_OVERLOAD_MAX2(POTION, OVERLOAD_2_20994, 2), + COX_OVERLOAD_MAX3(POTION, OVERLOAD_3_20995, 3), + COX_OVERLOAD_MAX4(POTION, OVERLOAD_4_20996, 4), ; private final ItemChargeType type; From 0ca25d4f46088c723e65c3a9614e4f280777013c Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 26 Nov 2020 14:21:14 -0500 Subject: [PATCH 019/173] chat controller: return 404 if task is not found This was returning a 200 with an empty body, causing the client to npe due to deserializing it as a Task with no task or location --- .../http/service/chat/ChatController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java index ccba9db430..8632a8b2f0 100644 --- a/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java +++ b/http-service/src/main/java/net/runelite/http/service/chat/ChatController.java @@ -34,6 +34,9 @@ import net.runelite.http.api.chat.LayoutRoom; import net.runelite.http.api.chat.Task; import net.runelite.http.service.util.exception.NotFoundException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.CacheControl; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -155,9 +158,18 @@ public class ChatController } @GetMapping("/task") - public Task getTask(@RequestParam String name) + public ResponseEntity getTask(@RequestParam String name) { - return chatService.getTask(name); + Task task = chatService.getTask(name); + if (task == null) + { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .build(); + } + + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(2, TimeUnit.MINUTES).cachePublic()) + .body(task); } @PostMapping("/pb") From 58136ff07b9759fc11ee25bfcf9d4b0d77f0b839 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 27 Nov 2020 04:37:15 -0700 Subject: [PATCH 020/173] runelite-client: build on java 8 again in java >=9 the type rules for have changed from to so this compiled correctly, where on java 8 it is invalid --- .../src/main/java/net/runelite/client/config/ConfigManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 3ef6744b54..95bde475aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -1151,7 +1151,7 @@ public class ConfigManager }); } - Set keys = (Set) ImmutableSet.copyOf((Set) properties.keySet()); + Set keys = (Set) ImmutableSet.copyOf((Set) properties.keySet()); keys: for (String key : keys) { From ba25de4bd11780dd0f219bfc34a1471d893adc87 Mon Sep 17 00:00:00 2001 From: logarithm Date: Wed, 27 Nov 2019 12:02:10 +0200 Subject: [PATCH 021/173] skybox: add custom sky color options Co-authored-by: Adam --- .../main/java/net/runelite/api/Constants.java | 5 ++ .../client/plugins/skybox/SkyboxPlugin.java | 23 ++++++++- .../plugins/skybox/SkyboxPluginConfig.java | 50 +++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java diff --git a/runelite-api/src/main/java/net/runelite/api/Constants.java b/runelite-api/src/main/java/net/runelite/api/Constants.java index 48ff3fc4bf..5d3259ed5b 100644 --- a/runelite-api/src/main/java/net/runelite/api/Constants.java +++ b/runelite-api/src/main/java/net/runelite/api/Constants.java @@ -82,6 +82,11 @@ public class Constants public static final int TILE_FLAG_BRIDGE = 2; + /** + * The height of the overworld, in tiles. Coordinates above this are in caves and other such zones. + */ + public static final int OVERWORLD_MAX_Y = 4160; + /** * The number of milliseconds in a client tick. *

diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java index 55b1a37017..468e23a201 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java @@ -25,13 +25,17 @@ package net.runelite.client.plugins.skybox; import com.google.inject.Inject; +import com.google.inject.Provides; +import java.awt.Color; import java.io.IOException; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.Player; import net.runelite.api.coords.LocalPoint; import net.runelite.api.events.BeforeRender; 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; @@ -47,6 +51,9 @@ public class SkyboxPlugin extends Plugin @Inject private Client client; + @Inject + private SkyboxPluginConfig config; + private Skybox skybox; @Override @@ -62,6 +69,12 @@ public class SkyboxPlugin extends Plugin skybox = null; } + @Provides + SkyboxPluginConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(SkyboxPluginConfig.class); + } + private int mapChunk(int cx, int cy, int plane) { cx -= client.getBaseX() / 8; @@ -91,6 +104,14 @@ public class SkyboxPlugin extends Plugin return; } + Color overrideColor = player.getWorldLocation().getY() < Constants.OVERWORLD_MAX_Y + ? config.customOverworldColor() : config.customOtherColor(); + if (overrideColor != null) + { + client.setSkyboxColor(overrideColor.getRGB()); + return; + } + int px, py; if (client.getOculusOrbState() == 1) { @@ -99,7 +120,7 @@ public class SkyboxPlugin extends Plugin } else { - LocalPoint p = client.getLocalPlayer().getLocalLocation(); + LocalPoint p = player.getLocalLocation(); px = p.getX(); py = p.getY(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java new file mode 100644 index 0000000000..3968724b72 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019 logarrhytmic + * 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.skybox; + +import java.awt.Color; +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("skybox") +public interface SkyboxPluginConfig extends Config +{ + @ConfigItem( + keyName = "customOverworldColor", + name = "Overworld sky color", + description = "Sets the color to use for the sky in overworld areas.", + position = 1 + ) + Color customOverworldColor(); + + @ConfigItem( + keyName = "customOtherColor", + name = "Cave sky color", + description = "Sets the color to use for the sky in non-overworld areas.", + position = 2 + ) + Color customOtherColor(); +} From 23b7a65c295c250a90971a727cfa93c69e84b805 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 27 Nov 2020 15:15:52 -0500 Subject: [PATCH 022/173] chatfilter: fix filtering self and clan messages with chat icons This was incorrectly filtering self/clan messages from players with chat icons due to not stripping the icon tag before matching the player name. --- .../plugins/chatfilter/ChatFilterPlugin.java | 2 +- .../plugins/chatfilter/ChatFilterPluginTest.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java index 57be625ee4..5340be1df0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java @@ -173,7 +173,7 @@ public class ChatFilterPlugin extends Plugin case PRIVATECHAT: case MODPRIVATECHAT: case FRIENDSCHAT: - if (shouldFilterPlayerMessage(name)) + if (shouldFilterPlayerMessage(Text.removeTags(name))) { message = censorMessage(name, message); blockMessage = message == null; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java index 547e468c87..f12ae93e4a 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java @@ -46,6 +46,7 @@ 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.mock; import static org.mockito.Mockito.when; import org.mockito.junit.MockitoJUnitRunner; @@ -406,4 +407,18 @@ public class ChatFilterPluginTest assertEquals(1, client.getIntStack()[client.getIntStackSize() - 3]); assertEquals("testMessage (4)", client.getStringStack()[client.getStringStackSize() - 1]); } + + @Test + public void testChatIcons() + { + when(chatFilterConfig.filteredWords()).thenReturn("test"); + // if this test is broken, this stubbing is required to trip the assert + lenient().when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + when(friendChatManager.isMember("Lazark")).thenReturn(true); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Lazark", "test", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals(1, client.getIntStack()[client.getIntStackSize() - 3]); // not filtered + } } \ No newline at end of file From 374cf05c6d7481eea4f9446696bbef2e78b18905 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Wed, 18 Nov 2020 08:21:05 +0000 Subject: [PATCH 023/173] timetracking: add support for botanist relic --- .../timetracking/TimeTrackingConfig.java | 1 + .../timetracking/farming/FarmingTracker.java | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java index cb24e6b9b3..494320517a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java @@ -35,6 +35,7 @@ public interface TimeTrackingConfig extends Config String CONFIG_GROUP = "timetracking"; String AUTOWEED = "autoweed"; String BIRD_HOUSE = "birdhouse"; + String BOTANIST = "botanist"; String TIMERS = "timers"; String STOPWATCHES = "stopwatches"; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java index 192a4d5ab5..298e91a5ce 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java @@ -91,6 +91,15 @@ public class FarmingTracker } } + { + boolean botanist = client.getVar(Varbits.LEAGUE_RELIC_5) == 1; + if (!Boolean.valueOf(botanist).equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, Boolean.class))) + { + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, botanist); + changed = true; + } + } + for (FarmingRegion region : farmingWorld.getRegions().get(location.getRegionID())) { if (!region.isInBounds(location)) @@ -152,6 +161,9 @@ public class FarmingTracker boolean autoweed = Integer.toString(Autoweed.ON.ordinal()) .equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED)); + boolean botanist = Boolean.TRUE + .equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.BOTANIST, Boolean.class)); + String key = patch.getRegion().getRegionID() + "." + patch.getVarbit().getId(); String storedValue = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, key); @@ -192,6 +204,7 @@ public class FarmingTracker int stage = state.getStage(); int stages = state.getStages(); int tickrate = state.getTickRate() * 60; + int farmingTickLength = 5 * 60; if (autoweed && state.getProduce() == Produce.WEEDS) { @@ -200,14 +213,20 @@ public class FarmingTracker tickrate = 0; } + if (botanist) + { + tickrate /= 5; + farmingTickLength /= 5; + } + long doneEstimate = 0; if (tickrate > 0) { - long tickNow = (unixNow + (5 * 60)) / tickrate; - long tickTime = (unixTime + (5 * 60)) / tickrate; + long tickNow = (unixNow + farmingTickLength) / tickrate; + long tickTime = (unixTime + farmingTickLength) / tickrate; int delta = (int) (tickNow - tickTime); - doneEstimate = ((stages - 1 - stage) + tickTime) * tickrate + (5 * 60); + doneEstimate = ((stages - 1 - stage) + tickTime) * tickrate + farmingTickLength; stage += delta; if (stage >= stages) From b59f099c004f498d7e665426db060d5136598bf6 Mon Sep 17 00:00:00 2001 From: skyblownet <63957499+skyblownet@users.noreply.github.com> Date: Fri, 27 Nov 2020 21:39:09 +0100 Subject: [PATCH 024/173] slayer plugin: add Battlefront to task locations --- .../src/main/java/net/runelite/client/plugins/slayer/Task.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java index 79e89ba191..8e02556440 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java @@ -189,6 +189,7 @@ enum Task "Abyss", "Ancient Cavern", "Asgarnian Ice Dungeon", + "Battlefront", "Brimhaven Dungeon", "Brine Rat Cavern", "Catacombs of Kourend", From d8e97dd1f7ac40b2f99e3cba31b78732a9537fcb Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 28 Nov 2020 13:47:00 -0500 Subject: [PATCH 025/173] dps counter: add option to reset when boss dies --- .../runelite/client/plugins/dpscounter/DpsConfig.java | 11 +++++++++++ .../client/plugins/dpscounter/DpsCounterPlugin.java | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java index 5720f57016..0fa2dadb70 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java @@ -52,4 +52,15 @@ public interface DpsConfig extends Config { return false; } + + @ConfigItem( + position = 2, + keyName = "autoreset", + name = "Auto reset", + description = "Reset the DPS tracker when a boss dies" + ) + default boolean autoreset() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index cc317b790d..e919c897ba 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -270,7 +270,12 @@ public class DpsCounterPlugin extends Plugin { log.debug("Boss has died!"); - if (dpsConfig.autopause()) + if (dpsConfig.autoreset()) + { + members.values().forEach(DpsMember::reset); + total.reset(); + } + else if (dpsConfig.autopause()) { pause(); } From e9acabf54915efcdf6e7f8c29aef6d96f245b688 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 28 Nov 2020 14:32:09 -0500 Subject: [PATCH 026/173] dps counter: add option to only count boss damage --- .../runelite/client/plugins/dpscounter/DpsConfig.java | 11 +++++++++++ .../client/plugins/dpscounter/DpsCounterPlugin.java | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java index 0fa2dadb70..f730dd2c8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java @@ -63,4 +63,15 @@ public interface DpsConfig extends Config { return false; } + + @ConfigItem( + position = 3, + keyName = "bossDamage", + name = "Only boss damage", + description = "Only count damage done to the boss, and not to other NPCs" + ) + default boolean bossDamage() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index e919c897ba..54887b7223 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -186,6 +186,13 @@ public class DpsCounterPlugin extends Plugin if (hitsplat.isMine()) { + final int npcId = ((NPC) actor).getId(); + boolean isBoss = BOSSES.contains(npcId); + if (dpsConfig.bossDamage() && !isBoss) + { + return; + } + int hit = hitsplat.getAmount(); // Update local member PartyMember localMember = partyService.getLocalMember(); @@ -207,7 +214,7 @@ public class DpsCounterPlugin extends Plugin { final int npcId = ((NPC) actor).getId(); boolean isBoss = BOSSES.contains(npcId); - if (actor != player.getInteracting() && !isBoss) + if ((dpsConfig.bossDamage() || actor != player.getInteracting()) && !isBoss) { // only track damage to npcs we are attacking, or is a nearby common boss return; From a658d94db096d53111f1e24d14aeeca3ae437963 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 28 Nov 2020 14:40:35 -0500 Subject: [PATCH 027/173] notifier: move osx terminal-notifier test to executor Additionally set a timeout on the process --- .../java/net/runelite/client/Notifier.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index 77231f8a9e..872866c415 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -114,7 +114,7 @@ public class Notifier private final ChatMessageManager chatMessageManager; private final EventBus eventBus; private final Path notifyIconPath; - private final boolean terminalNotifierAvailable; + private boolean terminalNotifierAvailable; private Instant flashStart; private long mouseLastPressedMillis; private long lastClipMTime = CLIP_MTIME_UNLOADED; @@ -138,9 +138,10 @@ public class Notifier this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png"); // First check if we are running in launcher - this.terminalNotifierAvailable = - !Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion()) - && isTerminalNotifierAvailable(); + if (!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion()) && OSType.getOSType() == OSType.MacOS) + { + executorService.execute(() -> terminalNotifierAvailable = isTerminalNotifierAvailable()); + } storeIcon(); } @@ -389,21 +390,19 @@ public class Notifier private boolean isTerminalNotifierAvailable() { - if (OSType.getOSType() == OSType.MacOS) + try { - try - { - final Process exec = Runtime.getRuntime().exec(new String[]{"terminal-notifier", "-help"}); - exec.waitFor(); - return exec.exitValue() == 0; - } - catch (IOException | InterruptedException e) + final Process exec = Runtime.getRuntime().exec(new String[]{"terminal-notifier", "-help"}); + if (!exec.waitFor(2, TimeUnit.SECONDS)) { return false; } + return exec.exitValue() == 0; + } + catch (IOException | InterruptedException e) + { + return false; } - - return false; } private static String toUrgency(TrayIcon.MessageType type) From 8868d71c10d378ea972b398f9b8a9e7656c1328f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Tue, 3 Nov 2020 09:27:36 +0000 Subject: [PATCH 028/173] grounditems: add numerical despawn timers --- .../grounditems/GroundItemsConfig.java | 7 +- .../grounditems/GroundItemsOverlay.java | 101 ++++++++++++++---- .../grounditems/config/DespawnTimerMode.java | 33 ++++++ 3 files changed, 117 insertions(+), 24 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/DespawnTimerMode.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java index 61dbfb4447..43ce88dd2e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java @@ -31,6 +31,7 @@ import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; import net.runelite.client.config.Units; import net.runelite.client.config.ConfigSection; +import net.runelite.client.plugins.grounditems.config.DespawnTimerMode; import net.runelite.client.plugins.grounditems.config.HighlightTier; import net.runelite.client.plugins.grounditems.config.ItemHighlightMode; import net.runelite.client.plugins.grounditems.config.MenuHighlightMode; @@ -375,13 +376,13 @@ public interface GroundItemsConfig extends Config @ConfigItem( keyName = "groundItemTimers", - name = "Show despawn timers", + name = "Despawn timer", description = "Shows despawn timers for items you've dropped and received as loot", position = 28 ) - default boolean groundItemTimers() + default DespawnTimerMode groundItemTimers() { - return false; + return DespawnTimerMode.OFF; } @ConfigItem( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index fd22bbe164..ec1d0527c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -47,6 +47,7 @@ import net.runelite.api.Point; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import static net.runelite.client.plugins.grounditems.GroundItemsPlugin.MAX_QUANTITY; +import net.runelite.client.plugins.grounditems.config.DespawnTimerMode; import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU; import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; import net.runelite.client.ui.overlay.Overlay; @@ -175,7 +176,7 @@ public class GroundItemsOverlay extends Overlay plugin.setHighlightBoxBounds(null); final boolean onlyShowLoot = config.onlyShowLoot(); - final boolean groundItemTimers = config.groundItemTimers(); + final DespawnTimerMode groundItemTimers = config.groundItemTimers(); final boolean outline = config.textOutline(); for (GroundItem item : groundItemList) @@ -347,9 +348,38 @@ public class GroundItemsOverlay extends Overlay drawRectangle(graphics, itemHighlightBox, topItem && mouseInHighlightBox ? Color.GREEN : color, highlighted != null, false); } - if (groundItemTimers || plugin.isHotKeyPressed()) + // When the hotkey is pressed the hidden/highlight boxes are drawn to the right of the text, + // so always draw the pie since it is on the left hand side. + if (groundItemTimers == DespawnTimerMode.PIE || plugin.isHotKeyPressed()) { - drawTimerOverlay(graphics, textX, textY, item); + drawTimerPieOverlay(graphics, textX, textY, item); + } + else if (groundItemTimers == DespawnTimerMode.SECONDS || groundItemTimers == DespawnTimerMode.TICKS) + { + Instant despawnTime = calculateDespawnTime(item); + Color timerColor = getItemTimerColor(item); + if (despawnTime != null && timerColor != null) + { + long despawnTimeMillis = despawnTime.toEpochMilli() - Instant.now().toEpochMilli(); + final String timerText; + if (groundItemTimers == DespawnTimerMode.SECONDS) + { + timerText = String.format(" - %.1f", despawnTimeMillis / 1000f); + } + else // TICKS + { + timerText = String.format(" - %d", despawnTimeMillis / 600); + } + + // The timer text is drawn separately to have its own color, and is intentionally not included + // in the getCanvasTextLocation() call because the timer text can change per frame and we do not + // use a monospaced font, which causes the text location on screen to jump around slightly each frame. + textComponent.setText(timerText); + textComponent.setColor(timerColor); + textComponent.setOutline(outline); + textComponent.setPosition(new java.awt.Point(textX + fm.stringWidth(itemString), textY)); + textComponent.render(graphics); + } } textComponent.setText(itemString); @@ -362,12 +392,12 @@ public class GroundItemsOverlay extends Overlay return null; } - private void drawTimerOverlay(Graphics2D graphics, int textX, int textY, GroundItem groundItem) + private Instant calculateDespawnTime(GroundItem groundItem) { // We can only accurately guess despawn times for our own pvm loot and dropped items if (groundItem.getLootType() != LootType.PVM && groundItem.getLootType() != LootType.DROPPED) { - return; + return null; } // Loot appears to others after 1 minute, and despawns after 2 minutes @@ -377,18 +407,17 @@ public class GroundItemsOverlay extends Overlay Instant spawnTime = groundItem.getSpawnTime(); if (spawnTime == null) { - return; + return null; } Instant despawnTime; Instant now = Instant.now(); - Color fillColor; if (client.isInInstancedRegion()) { // Items in the Kraken instance appear to never despawn? if (isInKraken()) { - return; + return null; } else if (isInKBDorNMZ()) { @@ -410,7 +439,7 @@ public class GroundItemsOverlay extends Overlay // Dropped items in the NMZ instance appear to never despawn? if (groundItem.getLootType() == LootType.DROPPED) { - return; + return null; } else { @@ -422,8 +451,6 @@ public class GroundItemsOverlay extends Overlay { despawnTime = spawnTime.plus(DESPAWN_TIME_INSTANCE); } - - fillColor = PRIVATE_TIMER_COLOR; } else { @@ -435,21 +462,53 @@ public class GroundItemsOverlay extends Overlay { despawnTime = spawnTime.plus(DESPAWN_TIME_LOOT); } - - // If it has not yet been a minute, the item is private - if (spawnTime.plus(1, ChronoUnit.MINUTES).isAfter(now)) - { - fillColor = PRIVATE_TIMER_COLOR; - } - else - { - fillColor = PUBLIC_TIMER_COLOR; - } } if (now.isBefore(spawnTime) || now.isAfter(despawnTime)) { // that's weird + return null; + } + + return despawnTime; + } + + private Color getItemTimerColor(GroundItem groundItem) + { + // We can only accurately guess despawn times for our own pvm loot and dropped items + if (groundItem.getLootType() != LootType.PVM && groundItem.getLootType() != LootType.DROPPED) + { + return null; + } + + final Instant spawnTime = groundItem.getSpawnTime(); + if (spawnTime == null) + { + return null; + } + + final Instant now = Instant.now(); + + // If it has not yet been a minute, the item is private + if (client.isInInstancedRegion() || spawnTime.plus(1, ChronoUnit.MINUTES).isAfter(now)) + { + return PRIVATE_TIMER_COLOR; + } + else + { + return PUBLIC_TIMER_COLOR; + } + } + + private void drawTimerPieOverlay(Graphics2D graphics, int textX, int textY, GroundItem groundItem) + { + Instant now = Instant.now(); + Instant spawnTime = groundItem.getSpawnTime(); + Instant despawnTime = calculateDespawnTime(groundItem); + Color fillColor = getItemTimerColor(groundItem); + + if (spawnTime == null || despawnTime == null || fillColor == null) + { return; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/DespawnTimerMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/DespawnTimerMode.java new file mode 100644 index 0000000000..858bc48754 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/DespawnTimerMode.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020, 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.grounditems.config; + +public enum DespawnTimerMode +{ + OFF, + PIE, + TICKS, + SECONDS +} From 912847c1fd41bf337d8b1d46c01602d38938c338 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Nov 2020 19:17:58 -0500 Subject: [PATCH 029/173] worldmap: add Getting Ahead quest start location Co-authored-by: jsambon --- runelite-api/src/main/java/net/runelite/api/Quest.java | 1 + .../net/runelite/client/plugins/worldmap/QuestStartLocation.java | 1 + 2 files changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Quest.java b/runelite-api/src/main/java/net/runelite/api/Quest.java index 4fb73936e3..c06ed30dff 100644 --- a/runelite-api/src/main/java/net/runelite/api/Quest.java +++ b/runelite-api/src/main/java/net/runelite/api/Quest.java @@ -179,6 +179,7 @@ public enum Quest THE_FREMENNIK_EXILES(718, "The Fremennik Exiles"), SINS_OF_THE_FATHER(1276, "Sins of the Father"), A_PORCINE_OF_INTEREST(1690, "A Porcine of Interest"), + GETTING_AHEAD(752, "Getting Ahead"), //Miniquests ENTER_THE_ABYSS(319, "Enter the Abyss"), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index 2fbb9ab84d..bf4c69b756 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -99,6 +99,7 @@ enum QuestStartLocation THE_FREMENNIK_EXILES(Quest.THE_FREMENNIK_EXILES, new WorldPoint(2658, 3669, 0)), GARDEN_OF_TRANQUILLITY(Quest.GARDEN_OF_TRANQUILLITY, new WorldPoint(3227, 3477, 0)), GERTRUDES_CAT_RATCATCHERS(Quest.GERTRUDES_CAT, new WorldPoint(3150, 3411, 0)), + GETTING_AHEAD(Quest.GETTING_AHEAD, new WorldPoint(1247, 3686, 0)), GHOSTS_AHOY(Quest.GHOSTS_AHOY, new WorldPoint(3677, 3510, 0)), THE_GIANT_DWARF(Quest.THE_GIANT_DWARF, new WorldPoint(2841, 10129, 0)), THE_GOLEM(Quest.THE_GOLEM, new WorldPoint(3487, 3089, 0)), From 82f937ec5d712e50e1127c7f08744b806d84d407 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Nov 2020 17:52:00 -0500 Subject: [PATCH 030/173] api: add queueChangedVarp --- runelite-api/src/main/java/net/runelite/api/Client.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 881cb4696e..82f37e577d 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -806,6 +806,13 @@ public interface Client extends GameEngine @VisibleForDevtools void setVarbitValue(int[] varps, int varbit, int value); + /** + * Mark the given varp as changed, causing var listeners to be + * triggered next tick + * @param varp + */ + void queueChangedVarp(int varp); + /** * Gets the widget flags table. * From 97f4ebf98598126ca3782f35b0be48594dcb8f09 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Nov 2020 17:52:34 -0500 Subject: [PATCH 031/173] devtools: queue changed varps in setvarb and setvarp --- .../net/runelite/client/plugins/devtools/DevToolsPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index e369574935..a02922c108 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -43,6 +43,7 @@ import net.runelite.api.MenuEntry; import net.runelite.api.NPC; import net.runelite.api.Player; import net.runelite.api.Skill; +import net.runelite.api.VarbitComposition; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.CommandExecuted; import net.runelite.api.events.MenuEntryAdded; @@ -264,6 +265,7 @@ public class DevToolsPlugin extends Plugin int varp = Integer.parseInt(args[0]); int value = Integer.parseInt(args[1]); client.setVarpValue(client.getVarps(), varp, value); + client.queueChangedVarp(varp); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); VarbitChanged varbitChanged = new VarbitChanged(); varbitChanged.setIndex(varp); @@ -282,6 +284,8 @@ public class DevToolsPlugin extends Plugin int varbit = Integer.parseInt(args[0]); int value = Integer.parseInt(args[1]); client.setVarbitValue(client.getVarps(), varbit, value); + VarbitComposition varbitComposition = client.getVarbit(varbit); + client.queueChangedVarp(varbitComposition.getIndex()); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null); eventBus.post(new VarbitChanged()); // fake event break; From 38c9e084ede573287fd7d6f1fe86f207b1be619a Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Nov 2020 17:57:17 -0500 Subject: [PATCH 032/173] Use raw varp array for get/set value in devtools It was decided the current indirection isn't necessary --- .../main/java/net/runelite/api/Client.java | 22 ------------------- .../plugins/devtools/DevToolsPlugin.java | 6 +++-- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 82f37e577d..93d2c2ef81 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -773,28 +773,6 @@ public interface Client extends GameEngine @VisibleForDevtools int getVarbitValue(int[] varps, int varbitId); - /** - * Gets the value of a given VarPlayer. - * - * @param varps passed varps - * @param varpId the VarpPlayer id - * @return the value - * @see VarPlayer#id - */ - @VisibleForDevtools - int getVarpValue(int[] varps, int varpId); - - /** - * Sets the value of a given VarPlayer. - * - * @param varps passed varps - * @param varpId the VarpPlayer id - * @param value the value - * @see VarPlayer#id - */ - @VisibleForDevtools - void setVarpValue(int[] varps, int varpId, int value); - /** * Sets the value of a given variable. * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index a02922c108..df0b342c3b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -256,7 +256,8 @@ public class DevToolsPlugin extends Plugin case "getvarp": { int varp = Integer.parseInt(args[0]); - int value = client.getVarpValue(client.getVarps(), varp); + int[] varps = client.getVarps(); + int value = varps[varp]; client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "VarPlayer " + varp + ": " + value, null); break; } @@ -264,7 +265,8 @@ public class DevToolsPlugin extends Plugin { int varp = Integer.parseInt(args[0]); int value = Integer.parseInt(args[1]); - client.setVarpValue(client.getVarps(), varp, value); + int[] varps = client.getVarps(); + varps[varp] = value; client.queueChangedVarp(varp); client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); VarbitChanged varbitChanged = new VarbitChanged(); From 68dfa2148242355a4382aeb922301908947b2e1b Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Dec 2020 10:49:32 -0500 Subject: [PATCH 033/173] timers: ignore config changed events for other config groups Also make a local variable for message in the chat message handler --- .../client/plugins/timers/TimersConfig.java | 4 +- .../client/plugins/timers/TimersPlugin.java | 59 ++++++++++--------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java index d57ea0523d..e26b8cf473 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java @@ -29,9 +29,11 @@ import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; import java.time.Instant; -@ConfigGroup("timers") +@ConfigGroup(TimersConfig.GROUP) public interface TimersConfig extends Config { + String GROUP = "timers"; + @ConfigItem( keyName = "showHomeMinigameTeleports", name = "Teleport cooldown timers", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index f53238ab87..eaf61a7d27 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -287,6 +287,11 @@ public class TimersPlugin extends Plugin @Subscribe public void onConfigChanged(ConfigChanged event) { + if (!event.getGroup().equals(TimersConfig.GROUP)) + { + return; + } + if (!config.showHomeMinigameTeleports()) { removeGameTimer(HOME_TELEPORT); @@ -456,55 +461,56 @@ public class TimersPlugin extends Plugin @Subscribe public void onChatMessage(ChatMessage event) { + final String message = event.getMessage(); if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) { return; } - if (event.getMessage().equals(ENDURANCE_EFFECT_MESSAGE)) + if (message.equals(ENDURANCE_EFFECT_MESSAGE)) { wasWearingEndurance = true; } - if (config.showStamina() && (event.getMessage().equals(STAMINA_DRINK_MESSAGE) || event.getMessage().equals(STAMINA_SHARED_DRINK_MESSAGE))) + if (config.showStamina() && (message.equals(STAMINA_DRINK_MESSAGE) || message.equals(STAMINA_SHARED_DRINK_MESSAGE))) { createStaminaTimer(); } - if (event.getMessage().equals(STAMINA_EXPIRED_MESSAGE) || event.getMessage().equals(GAUNTLET_ENTER_MESSAGE)) + if (message.equals(STAMINA_EXPIRED_MESSAGE) || message.equals(GAUNTLET_ENTER_MESSAGE)) { removeGameTimer(STAMINA); staminaTimer = null; } - if (config.showAntiFire() && event.getMessage().equals(ANTIFIRE_DRINK_MESSAGE)) + if (config.showAntiFire() && message.equals(ANTIFIRE_DRINK_MESSAGE)) { createGameTimer(ANTIFIRE); } - if (config.showAntiFire() && event.getMessage().equals(EXTENDED_ANTIFIRE_DRINK_MESSAGE)) + if (config.showAntiFire() && message.equals(EXTENDED_ANTIFIRE_DRINK_MESSAGE)) { createGameTimer(EXANTIFIRE); } - if (config.showGodWarsAltar() && event.getMessage().equalsIgnoreCase(GOD_WARS_ALTAR_MESSAGE))//Normal altars are "You recharge your Prayer points." while gwd is "You recharge your Prayer." + if (config.showGodWarsAltar() && message.equalsIgnoreCase(GOD_WARS_ALTAR_MESSAGE))//Normal altars are "You recharge your Prayer points." while gwd is "You recharge your Prayer." { createGameTimer(GOD_WARS_ALTAR); } - if (config.showAntiFire() && event.getMessage().equals(EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE)) + if (config.showAntiFire() && message.equals(EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE)) { createGameTimer(EXSUPERANTIFIRE); } - if (config.showAntiFire() && event.getMessage().equals(ANTIFIRE_EXPIRED_MESSAGE)) + if (config.showAntiFire() && message.equals(ANTIFIRE_EXPIRED_MESSAGE)) { //they have the same expired message removeGameTimer(ANTIFIRE); removeGameTimer(EXANTIFIRE); } - if (config.showOverload() && event.getMessage().startsWith("You drink some of your") && event.getMessage().contains("overload")) + if (config.showOverload() && message.startsWith("You drink some of your") && message.contains("overload")) { if (client.getVar(Varbits.IN_RAID) == 1) { @@ -517,30 +523,30 @@ public class TimersPlugin extends Plugin } - if (config.showCannon() && (event.getMessage().equals(CANNON_FURNACE_MESSAGE) || event.getMessage().contains(CANNON_REPAIR_MESSAGE))) + if (config.showCannon() && (message.equals(CANNON_FURNACE_MESSAGE) || message.contains(CANNON_REPAIR_MESSAGE))) { TimerTimer cannonTimer = createGameTimer(CANNON); cannonTimer.setTooltip(cannonTimer.getTooltip() + " - World " + client.getWorld()); } - if (config.showCannon() && event.getMessage().equals(CANNON_PICKUP_MESSAGE)) + if (config.showCannon() && message.equals(CANNON_PICKUP_MESSAGE)) { removeGameTimer(CANNON); } - if (config.showMagicImbue() && event.getMessage().equals(MAGIC_IMBUE_MESSAGE)) + if (config.showMagicImbue() && message.equals(MAGIC_IMBUE_MESSAGE)) { createGameTimer(MAGICIMBUE); } - if (event.getMessage().equals(MAGIC_IMBUE_EXPIRED_MESSAGE)) + if (message.equals(MAGIC_IMBUE_EXPIRED_MESSAGE)) { removeGameTimer(MAGICIMBUE); } if (config.showTeleblock()) { - Matcher m = TELEBLOCK_PATTERN.matcher(event.getMessage()); + Matcher m = TELEBLOCK_PATTERN.matcher(message); if (m.find()) { String minss = m.group("mins"); @@ -549,58 +555,58 @@ public class TimersPlugin extends Plugin int secs = secss != null ? Integer.parseInt(secss) : 0; createGameTimer(TELEBLOCK, Duration.ofSeconds(mins * 60 + secs)); } - else if (event.getMessage().contains(KILLED_TELEBLOCK_OPPONENT_TEXT)) + else if (message.contains(KILLED_TELEBLOCK_OPPONENT_TEXT)) { removeGameTimer(TELEBLOCK); } } - if (config.showAntiFire() && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE)) + if (config.showAntiFire() && message.contains(SUPER_ANTIFIRE_DRINK_MESSAGE)) { createGameTimer(SUPERANTIFIRE); } - if (config.showAntiFire() && event.getMessage().equals(SUPER_ANTIFIRE_EXPIRED_MESSAGE)) + if (config.showAntiFire() && message.equals(SUPER_ANTIFIRE_EXPIRED_MESSAGE)) { removeGameTimer(SUPERANTIFIRE); } - if (config.showImbuedHeart() && event.getMessage().equals(IMBUED_HEART_READY_MESSAGE)) + if (config.showImbuedHeart() && message.equals(IMBUED_HEART_READY_MESSAGE)) { removeGameTimer(IMBUEDHEART); } - if (config.showPrayerEnhance() && event.getMessage().startsWith("You drink some of your") && event.getMessage().contains("prayer enhance")) + if (config.showPrayerEnhance() && message.startsWith("You drink some of your") && message.contains("prayer enhance")) { createGameTimer(PRAYER_ENHANCE); } - if (config.showPrayerEnhance() && event.getMessage().equals(PRAYER_ENHANCE_EXPIRED)) + if (config.showPrayerEnhance() && message.equals(PRAYER_ENHANCE_EXPIRED)) { removeGameTimer(PRAYER_ENHANCE); } - if (config.showCharge() && event.getMessage().equals(CHARGE_MESSAGE)) + if (config.showCharge() && message.equals(CHARGE_MESSAGE)) { createGameTimer(CHARGE); } - if (config.showCharge() && event.getMessage().equals(CHARGE_EXPIRED_MESSAGE)) + if (config.showCharge() && message.equals(CHARGE_EXPIRED_MESSAGE)) { removeGameTimer(CHARGE); } - if (config.showStaffOfTheDead() && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_MESSAGE)) + if (config.showStaffOfTheDead() && message.contains(STAFF_OF_THE_DEAD_SPEC_MESSAGE)) { createGameTimer(STAFF_OF_THE_DEAD); } - if (config.showStaffOfTheDead() && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE)) + if (config.showStaffOfTheDead() && message.contains(STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE)) { removeGameTimer(STAFF_OF_THE_DEAD); } - if (config.showFreezes() && event.getMessage().equals(FROZEN_MESSAGE)) + if (config.showFreezes() && message.equals(FROZEN_MESSAGE)) { freezeTimer = createGameTimer(ICEBARRAGE); freezeTime = client.getTickCount(); @@ -608,7 +614,7 @@ public class TimersPlugin extends Plugin if (config.showDivine()) { - Matcher mDivine = DIVINE_POTION_PATTERN.matcher(event.getMessage()); + Matcher mDivine = DIVINE_POTION_PATTERN.matcher(message); if (mDivine.find()) { switch (mDivine.group(1)) @@ -650,7 +656,6 @@ public class TimersPlugin extends Plugin if (config.showTzhaarTimers()) { - String message = event.getMessage(); Matcher matcher = TZHAAR_COMPLETE_MESSAGE.matcher(message); if (message.contains(TZHAAR_DEFEATED_MESSAGE) || matcher.matches()) From 764dce1dfc11f9bb1c775f520e9aeb7d45752834 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Dec 2020 10:51:19 -0500 Subject: [PATCH 034/173] timers: fix tzhaar timer tracking when disabled mid inferno This moves all of the timer tracking logic outside of the check for if the timer is on, and now also allows toggling the timer on and off when in the caves. --- .../client/plugins/timers/TimersPlugin.java | 81 ++++++++++--------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index eaf61a7d27..e4e96cc4a7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -124,8 +124,8 @@ public class TimersPlugin extends Plugin private static final int NMZ_MAP_REGION_ID = 9033; private static final Pattern TZHAAR_WAVE_MESSAGE = Pattern.compile("Wave: (\\d+)"); private static final String TZHAAR_DEFEATED_MESSAGE = "You have been defeated!"; - private static final Pattern TZHAAR_COMPLETE_MESSAGE = Pattern.compile("Your (TzTok-Jad|TzKal-Zuk) kill count is:"); - private static final Pattern TZHAAR_PAUSED_MESSAGE = Pattern.compile("The (Inferno|Fight Cave) has been paused. You may now log out."); + private static final Pattern TZHAAR_COMPLETE_MESSAGE = Pattern.compile("Your (?:TzTok-Jad|TzKal-Zuk) kill count is:"); + private static final Pattern TZHAAR_PAUSED_MESSAGE = Pattern.compile("The (?:Inferno|Fight Cave) has been paused. You may now log out."); private TimerTimer freezeTimer; private int freezeTime = -1; // time frozen, in game ticks @@ -392,6 +392,10 @@ public class TimersPlugin extends Plugin { removeTzhaarTimer(); } + else + { + createTzhaarTimer(); + } } @Subscribe @@ -654,62 +658,65 @@ public class TimersPlugin extends Plugin } } - if (config.showTzhaarTimers()) + if (message.equals(TZHAAR_DEFEATED_MESSAGE) || TZHAAR_COMPLETE_MESSAGE.matcher(message).matches()) { - Matcher matcher = TZHAAR_COMPLETE_MESSAGE.matcher(message); + log.debug("Stopping tzhaar timer"); + removeTzhaarTimer(); + config.tzhaarStartTime(null); + config.tzhaarLastTime(null); + return; + } - if (message.contains(TZHAAR_DEFEATED_MESSAGE) || matcher.matches()) + if (TZHAAR_PAUSED_MESSAGE.matcher(message).find()) + { + log.debug("Pausing tzhaar timer"); + config.tzhaarLastTime(Instant.now()); + if (config.showTzhaarTimers()) { - removeTzhaarTimer(); - config.tzhaarStartTime(null); - config.tzhaarLastTime(null); - return; - } - - Instant now = Instant.now(); - matcher = TZHAAR_PAUSED_MESSAGE.matcher(message); - if (matcher.find()) - { - config.tzhaarLastTime(now); createTzhaarTimer(); - return; } + return; + } - matcher = TZHAAR_WAVE_MESSAGE.matcher(message); - if (!matcher.find()) + Matcher matcher = TZHAAR_WAVE_MESSAGE.matcher(message); + if (matcher.find()) + { + int wave = Integer.parseInt(matcher.group(1)); + if (wave == 1) { - return; - } + log.debug("Starting tzhaar timer"); - if (config.tzhaarStartTime() == null) - { - int wave = Integer.parseInt(matcher.group(1)); - if (wave == 1) + Instant now = Instant.now(); + if (isInInferno()) { - if (isInInferno()) - { - // The first wave message of the inferno comes six seconds after the ingame timer starts counting - config.tzhaarStartTime(now.minus(Duration.ofSeconds(6))); - } - else - { - config.tzhaarStartTime(now); - } + // The first wave message of the inferno comes six seconds after the ingame timer starts counting + config.tzhaarStartTime(now.minus(Duration.ofSeconds(6))); + } + else + { + config.tzhaarStartTime(now); + } + config.tzhaarLastTime(null); + if (config.showTzhaarTimers()) + { createTzhaarTimer(); } } - else if (config.tzhaarLastTime() != null) + else if (config.tzhaarStartTime() != null && config.tzhaarLastTime() != null) { log.debug("Unpausing tzhaar timer"); // Advance start time by how long it has been paused Instant tzhaarStartTime = config.tzhaarStartTime(); - tzhaarStartTime = tzhaarStartTime.plus(Duration.between(config.tzhaarLastTime(), now)); + tzhaarStartTime = tzhaarStartTime.plus(Duration.between(config.tzhaarLastTime(), Instant.now())); config.tzhaarStartTime(tzhaarStartTime); config.tzhaarLastTime(null); - createTzhaarTimer(); + if (config.showTzhaarTimers()) + { + createTzhaarTimer(); + } } } } From a4daa407a1f23e857d0b4f4417c4fad9ff1f7521 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Dec 2020 16:52:29 -0500 Subject: [PATCH 035/173] timers: fix abyssal sire stun timer At some point this changed to no longer animate once the sire changed to the stunned type. This changes the timer to just use the npc changed event, which should work more reliably. --- .../client/plugins/timers/TimersPlugin.java | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index e4e96cc4a7..ec45039942 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -61,6 +61,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.GraphicChanged; import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.NpcChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.WidgetHiddenChanged; @@ -831,37 +832,34 @@ public class TimersPlugin extends Plugin } } + @Subscribe + public void onNpcChanged(NpcChanged npcChanged) + { + int id = npcChanged.getNpc().getId(); + int oldId = npcChanged.getOld().getId(); + + if (id == NpcID.ABYSSAL_SIRE_5888) + { + // stunned npc type + log.debug("Sire is stunned"); + if (config.showAbyssalSireStun()) + { + createGameTimer(ABYSSAL_SIRE_STUN); + } + } + else if (oldId == NpcID.ABYSSAL_SIRE_5888) + { + // change from stunned sire to anything else + log.debug("Sire is unstunned"); + removeGameTimer(ABYSSAL_SIRE_STUN); + } + } + @Subscribe public void onAnimationChanged(AnimationChanged event) { Actor actor = event.getActor(); - if (config.showAbyssalSireStun() - && actor instanceof NPC) - { - int npcId = ((NPC)actor).getId(); - - switch (npcId) - { - // Show the countdown when the Sire enters the stunned state. - case NpcID.ABYSSAL_SIRE_5888: - createGameTimer(ABYSSAL_SIRE_STUN); - break; - - // Hide the countdown if the Sire isn't in the stunned state. - // This is necessary because the Sire leaves the stunned - // state early once all all four respiratory systems are killed. - case NpcID.ABYSSAL_SIRE: - case NpcID.ABYSSAL_SIRE_5887: - case NpcID.ABYSSAL_SIRE_5889: - case NpcID.ABYSSAL_SIRE_5890: - case NpcID.ABYSSAL_SIRE_5891: - case NpcID.ABYSSAL_SIRE_5908: - removeGameTimer(ABYSSAL_SIRE_STUN); - break; - } - } - if (actor != client.getLocalPlayer()) { return; From 059edd77ca1ff35083f7a05dba81e13e5791fef4 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 1 Dec 2020 14:41:46 -0700 Subject: [PATCH 036/173] cache: allow concurrent disk storage reads --- cache/src/main/java/net/runelite/cache/fs/jagex/DataFile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/src/main/java/net/runelite/cache/fs/jagex/DataFile.java b/cache/src/main/java/net/runelite/cache/fs/jagex/DataFile.java index 89eb607eee..7b79f8b4f7 100644 --- a/cache/src/main/java/net/runelite/cache/fs/jagex/DataFile.java +++ b/cache/src/main/java/net/runelite/cache/fs/jagex/DataFile.java @@ -66,7 +66,7 @@ public class DataFile implements Closeable * @return * @throws IOException */ - public byte[] read(int indexId, int archiveId, int sector, int size) throws IOException + public synchronized byte[] read(int indexId, int archiveId, int sector, int size) throws IOException { if (sector <= 0L || dat.length() / SECTOR_SIZE < (long) sector) { @@ -169,7 +169,7 @@ public class DataFile implements Closeable return buffer.array(); } - public DataFileWriteResult write(int indexId, int archiveId, byte[] compressedData) throws IOException + public synchronized DataFileWriteResult write(int indexId, int archiveId, byte[] compressedData) throws IOException { int sector; int startSector; From d9b90e6c2d4113b03e1434d9ea1b2599091c5bb7 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 1 Dec 2020 14:42:33 -0700 Subject: [PATCH 037/173] cache: allow partial caches to load --- .../java/net/runelite/cache/fs/jagex/DiskStorage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cache/src/main/java/net/runelite/cache/fs/jagex/DiskStorage.java b/cache/src/main/java/net/runelite/cache/fs/jagex/DiskStorage.java index bebcc9711f..0e13537061 100644 --- a/cache/src/main/java/net/runelite/cache/fs/jagex/DiskStorage.java +++ b/cache/src/main/java/net/runelite/cache/fs/jagex/DiskStorage.java @@ -112,6 +112,11 @@ public class DiskStorage implements Storage public byte[] readIndex(int indexId) throws IOException { IndexEntry entry = index255.read(indexId); + if (entry == null) + { + return null; + } + byte[] indexData = data.read(index255.getIndexFileId(), entry.getId(), entry.getSector(), entry.getLength()); return indexData; } @@ -121,6 +126,11 @@ public class DiskStorage implements Storage logger.trace("Loading index {}", index.getId()); byte[] indexData = readIndex(index.getId()); + if (indexData == null) + { + return; + } + Container res = Container.decompress(indexData, null); byte[] data = res.data; From 747ff74b81cc50cb361a8e1ac43cc9fdedc149a9 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 1 Dec 2020 17:25:21 -0700 Subject: [PATCH 038/173] Update Item IDs to 2020-12-2 --- .../main/java/net/runelite/api/ItemID.java | 20 ++++++++++++++++++- .../java/net/runelite/api/NullItemID.java | 14 +++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index cca4b72841..549bd52ea5 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -3330,7 +3330,6 @@ public final class ItemID public static final int TILES = 5569; public static final int TILES_5570 = 5570; public static final int TILES_5571 = 5571; - public static final int DIAL = 5572; public static final int DESERT_AMULET = 5573; public static final int INITIATE_SALLET = 5574; public static final int INITIATE_HAUBERK = 5575; @@ -11547,5 +11546,24 @@ public final class ItemID public static final int BEEKEEPERS_GLOVES = 25135; public static final int BEEKEEPERS_BOOTS = 25137; public static final int BONE_FRAGMENTS = 25139; + public static final int CLAY_HEAD = 25145; + public static final int FUR_HEAD = 25146; + public static final int BLOODY_HEAD = 25147; + public static final int NEILANS_JOURNAL = 25152; + public static final int ORNATE_UNDEAD_COMBAT_DUMMY = 25154; + public static final int DECORATIVE_BOOTS_BROKEN = 25155; + public static final int DECORATIVE_FULL_HELM_BROKEN = 25157; + public static final int CASTLEWARS_BREW4 = 25159; + public static final int CASTLEWARS_BREW3 = 25160; + public static final int CASTLEWARS_BREW2 = 25161; + public static final int CASTLEWARS_BREW1 = 25162; + public static final int DECORATIVE_BOOTS = 25163; + public static final int DECORATIVE_FULL_HELM = 25165; + public static final int DECORATIVE_BOOTS_25167 = 25167; + public static final int DECORATIVE_FULL_HELM_25169 = 25169; + public static final int DECORATIVE_BOOTS_25171 = 25171; + public static final int DECORATIVE_BOOTS_L = 25173; + public static final int DECORATIVE_FULL_HELM_25174 = 25174; + public static final int DECORATIVE_FULL_HELM_L = 25176; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 158ae3fb3b..0f443dfe91 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -2128,6 +2128,7 @@ public final class NullItemID public static final int NULL_5550 = 5550; public static final int NULL_5551 = 5551; public static final int NULL_5552 = 5552; + public static final int NULL_5572 = 5572; public static final int NULL_5611 = 5611; public static final int NULL_5612 = 5612; public static final int NULL_5613 = 5613; @@ -13387,5 +13388,18 @@ public final class NullItemID public static final int NULL_25142 = 25142; public static final int NULL_25143 = 25143; public static final int NULL_25144 = 25144; + public static final int NULL_25148 = 25148; + public static final int NULL_25149 = 25149; + public static final int NULL_25150 = 25150; + public static final int NULL_25151 = 25151; + public static final int NULL_25153 = 25153; + public static final int NULL_25156 = 25156; + public static final int NULL_25158 = 25158; + public static final int NULL_25164 = 25164; + public static final int NULL_25166 = 25166; + public static final int NULL_25168 = 25168; + public static final int NULL_25170 = 25170; + public static final int NULL_25172 = 25172; + public static final int NULL_25175 = 25175; /* This file is automatically generated. Do not edit. */ } From 94de4ca1e23f204ea65c9a4051c71a843482e343 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 1 Dec 2020 17:25:21 -0700 Subject: [PATCH 039/173] Update Item variations to 2020-12-2 --- .../src/main/resources/item_variations.json | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 704d0fb2f8..9996438144 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -3402,7 +3402,12 @@ 4506, 4511, 20489, - 24160 + 24160, + 25157, + 25165, + 25169, + 25174, + 25176 ], "decorative shield": [ 4072, @@ -9478,5 +9483,18 @@ "extradimensional bag": [ 25106, 25108 + ], + "decorative boots": [ + 25155, + 25163, + 25167, + 25171, + 25173 + ], + "castlewars brew": [ + 25159, + 25160, + 25161, + 25162 ] } \ No newline at end of file From e652016f2f325d3165768cba28174cf2466deaab Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 1 Dec 2020 17:25:21 -0700 Subject: [PATCH 040/173] Update Object IDs to 2020-12-2 --- .../java/net/runelite/api/NullObjectID.java | 17 ++++++++ .../main/java/net/runelite/api/ObjectID.java | 41 +++++++++++++++---- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index f3c11e2598..95484a9022 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -9386,6 +9386,7 @@ public final class NullObjectID public static final int NULL_20842 = 20842; public static final int NULL_20846 = 20846; public static final int NULL_20857 = 20857; + public static final int NULL_20858 = 20858; public static final int NULL_20859 = 20859; public static final int NULL_20860 = 20860; public static final int NULL_20861 = 20861; @@ -19725,9 +19726,25 @@ public final class NullObjectID public static final int NULL_40352 = 40352; public static final int NULL_40353 = 40353; public static final int NULL_40354 = 40354; + public static final int NULL_40368 = 40368; + public static final int NULL_40369 = 40369; + public static final int NULL_40370 = 40370; + public static final int NULL_40371 = 40371; + public static final int NULL_40372 = 40372; + public static final int NULL_40373 = 40373; + public static final int NULL_40374 = 40374; + public static final int NULL_40375 = 40375; + public static final int NULL_40376 = 40376; + public static final int NULL_40377 = 40377; + public static final int NULL_40378 = 40378; + public static final int NULL_40379 = 40379; + public static final int NULL_40380 = 40380; public static final int NULL_40392 = 40392; public static final int NULL_40393 = 40393; public static final int NULL_40394 = 40394; public static final int NULL_40395 = 40395; + public static final int NULL_40427 = 40427; + public static final int NULL_40428 = 40428; + public static final int NULL_40429 = 40429; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 0ad9e0d818..1ab3210616 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -915,7 +915,7 @@ public final class ObjectID public static final int GRAPEVINE = 1753; public static final int GRAPEVINE_1754 = 1754; public static final int GLASS_DOOR = 1762; - public static final int PUMP_AND_DRAIN = 1763; + public static final int SINK_1763 = 1763; public static final int DUMMY_1764 = 1764; public static final int LEAFLETS = 1767; public static final int CHEST_1768 = 1768; @@ -5504,11 +5504,11 @@ public final class ObjectID public static final int BIRD_SNARE_9347 = 9347; public static final int BIRD_SNARE_9348 = 9348; public static final int BIRD_SNARE_9349 = 9349; - public static final int GRAVE_9354 = 9354; - public static final int GRAVE_9355 = 9355; - public static final int GRAVE_9356 = 9356; - public static final int GRAVE_9357 = 9357; - public static final int GRAVE_9358 = 9358; + public static final int ORNATE_COMBAT_DUMMY = 9354; + public static final int ORNATE_UNDEAD_COMBAT_DUMMY = 9355; + public static final int ORNATE_WILDERNESS_COMBAT_DUMMY = 9356; + public static final int ORNATE_KALPHITE_COMBAT_DUMMY = 9357; + public static final int ORNATE_KURASK_COMBAT_DUMMY = 9358; public static final int GRAVESTONE_9359 = 9359; public static final int GRAVESTONE_9360 = 9360; public static final int GRAVESTONE_9361 = 9361; @@ -7673,7 +7673,7 @@ public final class ObjectID public static final int SHELVES_13556 = 13556; public static final int SHELVES_13557 = 13557; public static final int SHELVES_13558 = 13558; - public static final int PUMP_AND_DRAIN_13559 = 13559; + public static final int PUMP_AND_DRAIN = 13559; public static final int PUMP_AND_DRAIN_13560 = 13560; public static final int PUMP_AND_TUB = 13561; public static final int PUMP_AND_TUB_13562 = 13562; @@ -11465,6 +11465,16 @@ public final class ObjectID public static final int EXIT_PORTAL_20843 = 20843; public static final int TREE_20844 = 20844; public static final int TREE_20845 = 20845; + public static final int GATE_20847 = 20847; + public static final int GATE_20848 = 20848; + public static final int GATE_20849 = 20849; + public static final int GATE_20850 = 20850; + public static final int FLOUR = 20851; + public static final int CAVE_20852 = 20852; + public static final int CAVE_20853 = 20853; + public static final int CAVE_20854 = 20854; + public static final int SKELETON_20855 = 20855; + public static final int SKELETON_20856 = 20856; public static final int COMPOST_BIN_20870 = 20870; public static final int COMPOST_BIN_20871 = 20871; public static final int COMPOST_BIN_20872 = 20872; @@ -20610,6 +20620,16 @@ public final class ObjectID public static final int LECTERN_40357 = 40357; public static final int LECTERN_40358 = 40358; public static final int PICTURE_40359 = 40359; + public static final int MOUNTED_HEAD_SPACE = 40360; + public static final int MOUNTED_HEAD = 40361; + public static final int SHELVES_40362 = 40362; + public static final int SHELVES_40363 = 40363; + public static final int WORKBENCH_40364 = 40364; + public static final int ROCKS_40365 = 40365; + public static final int ROCKS_40366 = 40366; + public static final int BARREL_OF_FLOUR_40367 = 40367; + public static final int STAIRCASE_40381 = 40381; + public static final int DOOR_40382 = 40382; public static final int MAGICAL_PUMPKIN = 40383; public static final int MAGICAL_PUMPKIN_40384 = 40384; public static final int MAGICAL_PUMPKIN_40385 = 40385; @@ -20646,5 +20666,12 @@ public final class ObjectID public static final int BIG_DOOR_40420 = 40420; public static final int TUNNEL_ENTRANCE_40421 = 40421; public static final int TUNNEL_ENTRANCE_40422 = 40422; + public static final int TABLE_40423 = 40423; + public static final int TABLE_40424 = 40424; + public static final int SHELVES_40425 = 40425; + public static final int WOOD_40426 = 40426; + public static final int ORNATE_VAMPYRE_COMBAT_DUMMY = 40430; + public static final int ORNATE_DRAGON_COMBAT_DUMMY = 40431; + public static final int TABLE_40432 = 40432; /* This file is automatically generated. Do not edit. */ } From 2c9b8a893361e9c58abfb3a236a9d69f2c076ebb Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 1 Dec 2020 17:25:21 -0700 Subject: [PATCH 041/173] Update NPC IDs to 2020-12-2 --- .../src/main/java/net/runelite/api/NpcID.java | 24 +++++++++++++++++-- .../main/java/net/runelite/api/NullNpcID.java | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 55a7703203..bae73caa99 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -7708,8 +7708,7 @@ public final class NpcID public static final int CAT_8594 = 8594; public static final int FELFIZ_YARYUS = 8595; public static final int KEITH = 8596; - public static final int GORDON = 8597; - public static final int MARY_8598 = 8598; + public static final int ORNATE_COMBAT_DUMMY = 8598; public static final int SHAYZIEN_SOLDIER_8599 = 8599; public static final int SHAYZIEN_SERGEANT = 8600; public static final int SHAYZIEN_ARCHER = 8601; @@ -8869,5 +8868,26 @@ public final class NpcID public static final int CAPTAIN_SHORACKS_10489 = 10489; public static final int CAPTAIN_SHORACKS_10490 = 10490; public static final int CAPTAIN_SHORACKS_10491 = 10491; + public static final int HEADLESS_BEAST_HARD = 10492; + public static final int HEADLESS_BEAST = 10493; + public static final int CHICKEN_10494 = 10494; + public static final int CHICKEN_10495 = 10495; + public static final int CHICKEN_10496 = 10496; + public static final int CHICKEN_10497 = 10497; + public static final int CHICKEN_10498 = 10498; + public static final int CHICKEN_10499 = 10499; + public static final int GORDON = 10500; + public static final int GORDON_10501 = 10501; + public static final int MARY_10502 = 10502; + public static final int MARY_10503 = 10503; + public static final int MARY_10504 = 10504; + public static final int SHAYZIEN_SERGEANT_10505 = 10505; + public static final int HEADLESS_BEAST_10506 = 10506; + public static final int ORNATE_UNDEAD_COMBAT_DUMMY = 10507; + public static final int ORNATE_WILDERNESS_COMBAT_DUMMY = 10508; + public static final int ORNATE_KALPHITE_COMBAT_DUMMY = 10509; + public static final int ORNATE_KURASK_COMBAT_DUMMY = 10510; + public static final int ORNATE_UNDEAD_COMBAT_DUMMY_10511 = 10511; + public static final int ORNATE_UNDEAD_COMBAT_DUMMY_10512 = 10512; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java index 44075d54de..32f4672ce5 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java @@ -873,6 +873,7 @@ public final class NullNpcID public static final int NULL_8489 = 8489; public static final int NULL_8490 = 8490; public static final int NULL_8516 = 8516; + public static final int NULL_8597 = 8597; public static final int NULL_8624 = 8624; public static final int NULL_8625 = 8625; public static final int NULL_8626 = 8626; From 77681a3f3efc135e8376efad25aae1f34ed9ac63 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 1 Dec 2020 17:25:21 -0700 Subject: [PATCH 042/173] Update Scripts to 2020-12-2 --- .../main/scripts/OptionsPanelZoomUpdater.hash | 2 +- .../scripts/OptionsPanelZoomUpdater.rs2asm | 6 +- .../src/main/scripts/options_allsounds.hash | 1 - .../src/main/scripts/options_allsounds.rs2asm | 140 ------------------ 4 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 runelite-client/src/main/scripts/options_allsounds.hash delete mode 100644 runelite-client/src/main/scripts/options_allsounds.rs2asm diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash index f4a40ef439..5c600ecde2 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash +++ b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash @@ -1 +1 @@ -AA7DEC763D0B598D920956D8D46E890C502B71CB7D022A89F7930BD91E1F8468 \ No newline at end of file +8FC0BFFDA625B6C461DE5D63771FE7A48F8833F35FA8AE4C07EAA79984803C47 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm index 3abf21a570..831a469192 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm +++ b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm @@ -23,9 +23,9 @@ runelite_callback sub istore 1 - iconst 17104910 + iconst 7602230 if_getwidth - iconst 17104911 + iconst 7602231 if_getwidth sub istore 2 @@ -78,6 +78,6 @@ LABEL44: iconst 0 iconst 0 iconst 0 - iconst 17104911 + iconst 7602231 if_setposition return diff --git a/runelite-client/src/main/scripts/options_allsounds.hash b/runelite-client/src/main/scripts/options_allsounds.hash deleted file mode 100644 index 84863d9bd2..0000000000 --- a/runelite-client/src/main/scripts/options_allsounds.hash +++ /dev/null @@ -1 +0,0 @@ -950ADB6A28E029005D24F99A65EF4D2AC4486EDC680D8770F4435F0300AA1299 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/options_allsounds.rs2asm b/runelite-client/src/main/scripts/options_allsounds.rs2asm deleted file mode 100644 index 2d4e94e9ce..0000000000 --- a/runelite-client/src/main/scripts/options_allsounds.rs2asm +++ /dev/null @@ -1,140 +0,0 @@ -.id 358 -.int_stack_count 6 -.string_stack_count 0 -.int_var_count 6 -.string_var_count 0 -; callback "optionsAllSounds" -; Used by the MusicPlugin to hide the vanilla (blue) volume handles -; Enable the MusicPlugin and go to the volume options panel. There should -; only be a green handle on the slider - iload 0 - sconst "optionsAllSounds" - runelite_callback - istore 0 - iload 0 - iconst 4 - if_icmpeq LABEL4 - jump LABEL20 -LABEL4: - iconst 687 - iload 1 - if_setgraphic - iconst 693 - iload 2 - if_setgraphic - iconst 694 - iload 3 - if_setgraphic - iconst 695 - iload 4 - if_setgraphic - iconst 696 - iload 5 - if_setgraphic - jump LABEL115 -LABEL20: - iload 0 - iconst 3 - if_icmpeq LABEL24 - jump LABEL40 -LABEL24: - iconst 692 - iload 1 - if_setgraphic - iconst 688 - iload 2 - if_setgraphic - iconst 694 - iload 3 - if_setgraphic - iconst 695 - iload 4 - if_setgraphic - iconst 696 - iload 5 - if_setgraphic - jump LABEL115 -LABEL40: - iload 0 - iconst 2 - if_icmpeq LABEL44 - jump LABEL60 -LABEL44: - iconst 692 - iload 1 - if_setgraphic - iconst 693 - iload 2 - if_setgraphic - iconst 689 - iload 3 - if_setgraphic - iconst 695 - iload 4 - if_setgraphic - iconst 696 - iload 5 - if_setgraphic - jump LABEL115 -LABEL60: - iload 0 - iconst 1 - if_icmpeq LABEL64 - jump LABEL80 -LABEL64: - iconst 692 - iload 1 - if_setgraphic - iconst 693 - iload 2 - if_setgraphic - iconst 694 - iload 3 - if_setgraphic - iconst 690 - iload 4 - if_setgraphic - iconst 696 - iload 5 - if_setgraphic - jump LABEL115 -LABEL80: - iload 0 - iconst 0 - if_icmpeq LABEL84 - jump LABEL100 -LABEL84: - iconst 692 - iload 1 - if_setgraphic - iconst 693 - iload 2 - if_setgraphic - iconst 694 - iload 3 - if_setgraphic - iconst 695 - iload 4 - if_setgraphic - iconst 691 - iload 5 - if_setgraphic - jump LABEL115 -LABEL100: - iconst 692 - iload 1 - if_setgraphic - iconst 693 - iload 2 - if_setgraphic - iconst 694 - iload 3 - if_setgraphic - iconst 695 - iload 4 - if_setgraphic - iconst 696 - iload 5 - if_setgraphic -LABEL115: - return From e60c25be994018f12a53ee35fe117f8a3fe60f45 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 1 Dec 2020 20:24:44 -0700 Subject: [PATCH 043/173] music: remove volume slider granularity this interface was entirely rewritten --- .../main/java/net/runelite/api/ScriptID.java | 10 - .../net/runelite/api/widgets/WidgetInfo.java | 3 - .../client/plugins/music/MusicPlugin.java | 278 ------------------ 3 files changed, 291 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 3e9e426d4d..7679476c49 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -83,16 +83,6 @@ public final class ScriptID @ScriptArguments(integer = 2) public static final int MESSAGE_LAYER_CLOSE = 299; - /** - * Sets the background for sound option bars - *

    - *
  • int Value of the slider (0-4)
  • - *
  • int (WidgetID) * 5, segments of the slider
  • - *
- */ - @ScriptArguments(integer = 6) - public static final int OPTIONS_ALLSOUNDS = 358; - /** * Readies the chatbox panel for things like the chatbox input * Inverse of MESSAGE_LAYER_CLOSE diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 3a9f5b5856..9205b8d1e2 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -533,9 +533,6 @@ public enum WidgetInfo SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER), OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.CAMERA_ZOOM_SLIDER_HANDLE), - OPTIONS_MUSIC_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.MUSIC_SLIDER), - OPTIONS_SOUND_EFFECT_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.SOUND_EFFECT_SLIDER), - OPTIONS_AREA_SOUND_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.AREA_SOUND_SLIDER), ACHIEVEMENT_DIARY_CONTAINER(WidgetID.ACHIEVEMENT_DIARY_GROUP_ID, WidgetID.AchievementDiary.CONTAINER), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index c2db561546..ab6757e11a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -32,14 +32,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Set; -import java.util.function.BiConsumer; -import java.util.function.ToIntFunction; import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -49,18 +45,13 @@ import net.runelite.api.ScriptID; import net.runelite.api.SoundEffectID; import net.runelite.api.SpriteID; import net.runelite.api.VarClientInt; -import net.runelite.api.VarPlayer; import net.runelite.api.events.AreaSoundEffectPlayed; -import net.runelite.api.events.BeforeRender; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.SoundEffectPlayed; import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.events.VolumeChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetConfig; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetPositionMode; @@ -68,13 +59,10 @@ import net.runelite.api.widgets.WidgetType; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxTextInput; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; @PluginDescriptor( name = "Music", @@ -129,9 +117,6 @@ public class MusicPlugin extends Plugin @Inject private ChatboxPanelManager chatboxPanelManager; - @Inject - private TooltipManager tooltipManager; - private ChatboxTextInput searchInput; private Widget musicSearchButton; @@ -141,16 +126,12 @@ public class MusicPlugin extends Plugin private MusicState currentMusicFilter = MusicState.ALL; - private MusicSlider hoveredSlider; - @Override protected void startUp() { clientThread.invoke(() -> { addMusicButtons(); - applyMusicVolumeConfig(); - updateMusicOptions(); }); } @@ -164,8 +145,6 @@ public class MusicPlugin extends Plugin } tracks = null; - hoveredSlider = null; - clientThread.invoke(this::teardownMusicOptions); } @Provides @@ -196,10 +175,6 @@ public class MusicPlugin extends Plugin currentMusicFilter = MusicState.ALL; addMusicButtons(); } - if (widgetLoaded.getGroupId() == WidgetID.OPTIONS_GROUP_ID) - { - updateMusicOptions(); - } } private void addMusicButtons() @@ -250,44 +225,6 @@ public class MusicPlugin extends Plugin } } - @Subscribe - public void onVolumeChanged(VolumeChanged volumeChanged) - { - applyMusicVolumeConfig(); - } - - @Subscribe - public void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("music")) - { - clientThread.invokeLater(this::applyMusicVolumeConfig); - } - } - - private void applyMusicVolumeConfig() - { - int musicVolume = musicConfig.getMusicVolume(); - if (musicVolume > 0) - { - client.setMusicVolume(musicVolume - 1); - } - - int soundEffectVolume = musicConfig.getSoundEffectVolume(); - if (soundEffectVolume > 0) - { - client.setSoundEffectVolume(soundEffectVolume - 1); - } - - int areaSoundEffectVolume = musicConfig.getAreaSoundEffectVolume(); - if (areaSoundEffectVolume > 0) - { - client.setAreaSoundEffectVolume(areaSoundEffectVolume - 1); - } - - updateMusicOptions(); - } - private boolean isOnMusicTab() { return client.getVar(VarClientInt.INVENTORY_TAB) == 13; @@ -413,221 +350,6 @@ public class MusicPlugin extends Plugin private final int spriteID; } - @RequiredArgsConstructor - @Getter - private enum MusicSlider - { - MUSIC("Music", WidgetInfo.OPTIONS_MUSIC_SLIDER, VarPlayer.MUSIC_VOLUME, MusicConfig::getMusicVolume, MusicConfig::setMusicVolume, 255), - AREA("Area Sounds", WidgetInfo.OPTIONS_AREA_SOUND_SLIDER, VarPlayer.AREA_EFFECT_VOLUME, MusicConfig::getAreaSoundEffectVolume, MusicConfig::setAreaSoundEffectVolume, 127), - EFFECT("Sound Effects", WidgetInfo.OPTIONS_SOUND_EFFECT_SLIDER, VarPlayer.SOUND_EFFECT_VOLUME, MusicConfig::getSoundEffectVolume, MusicConfig::setSoundEffectVolume, 127); - - private final String name; - private final WidgetInfo widgetID; - private final VarPlayer var; - private final ToIntFunction getter; - private final BiConsumer setter; - private final int max; - - @Setter - private Widget handle; - - @Setter - private Widget track; - - private static int PADDING = 8; - - private int getX() - { - return getTrack().getRelativeX() + PADDING; - } - - private int getWidth() - { - return getTrack().getWidth() - (PADDING * 2) - handle.getWidth(); - } - - private int getValue(final MusicConfig config, final Client client) - { - int value = getter.applyAsInt(config) - 1; - if (value <= -1) - { - // Use the vanilla value - value = ((4 - client.getVar(var)) * max) / 4; - } - - return value; - } - } - - private void teardownMusicOptions() - { - for (MusicSlider slider : MusicSlider.values()) - { - Widget icon = client.getWidget(slider.getWidgetID()); - if (icon == null) - { - return; - } - - if (slider.getHandle() != null) - { - { - Widget handle = slider.getHandle(); - Widget parent = handle.getParent(); - if (parent == null) - { - continue; - } - else - { - Widget[] siblings = parent.getChildren(); - if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) - { - continue; - } - siblings[slider.getTrack().getIndex()] = null; - siblings[handle.getIndex()] = null; - } - } - - Object[] init = icon.getOnLoadListener(); - init[1] = slider.getWidgetID().getId(); - - // Readd the var transmit triggers and rerun options_allsounds - client.runScript(init); - slider.setHandle(null); - slider.setTrack(null); - } - } - } - - private void updateMusicOptions() - { - for (MusicSlider slider : MusicSlider.values()) - { - Widget icon = client.getWidget(slider.getWidgetID()); - // VolumeChanged can trigger us before the sliders interface is fully valid, so - // we check if the width is set before we copy it to all of our widgets - if (icon == null || icon.getWidth() == 0) - { - return; - } - - Widget handle = slider.getHandle(); - if (handle != null) - { - Widget parent = handle.getParent(); - if (parent == null) - { - handle = null; - } - else - { - Widget[] siblings = parent.getChildren(); - if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) - { - handle = null; - } - } - } - if (handle == null) - { - Object[] init = icon.getOnLoadListener(); - icon.setVarTransmitTrigger((int[]) null); - - Widget track = icon.getParent().createChild(-1, WidgetType.TEXT); - slider.setTrack(track); - handle = icon.getParent().createChild(-1, WidgetType.GRAPHIC); - slider.setHandle(handle); - - { - // First widget of the track - int wid = (Integer) init[2]; - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); - - track.setOriginalX(w.getRelativeX()); - track.setOriginalY(w.getRelativeY()); - } - { - // Last widget of the track - int wid = (Integer) init[6]; - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); - - track.setOriginalWidth((w.getRelativeX() + w.getWidth()) - track.getOriginalX()); - } - - track.setOriginalHeight(16); - track.setNoClickThrough(true); - track.revalidate(); - - handle.setSpriteId(SpriteID.OPTIONS_ZOOM_SLIDER_THUMB); - handle.setOriginalWidth(16); - handle.setOriginalHeight(16); - handle.setClickMask(WidgetConfig.DRAG); - handle.revalidate(); - - handle.setOnMouseRepeatListener((JavaScriptCallback) ev -> hoveredSlider = slider); - handle.setHasListener(true); - - JavaScriptCallback move = ev -> - { - int newVal = ((ev.getMouseX() - MusicSlider.PADDING - (slider.getHandle().getWidth() / 2)) * slider.getMax()) - / slider.getWidth(); - if (newVal < 0) - { - newVal = 0; - } - if (newVal > slider.getMax()) - { - newVal = slider.getMax(); - } - - // We store +1 so we can tell the difference between 0 and muted - slider.getSetter().accept(musicConfig, newVal + 1); - applyMusicVolumeConfig(); - }; - - track.setOnClickListener(move); - track.setOnHoldListener(move); - track.setOnReleaseListener(move); - track.setHasListener(true); - - client.runScript(ScriptID.OPTIONS_ALLSOUNDS, -1, init[2], init[3], init[4], init[5], init[6]); - } - - final int value = slider.getValue(musicConfig, client); - final int newX = ((value * slider.getWidth()) / slider.getMax()) + slider.getX(); - slider.getHandle().setOriginalX(newX); - slider.getHandle().setOriginalY(slider.getTrack().getOriginalY()); - slider.getHandle().revalidate(); - } - } - - @Subscribe - public void onBeforeRender(final BeforeRender event) - { - // Tooltips are auto-cleared before each render frame; create a new updated one for this frame - if (hoveredSlider != null) - { - final int value = hoveredSlider.getValue(musicConfig, client); - final int percent = (int) Math.round((value * 100.0 / hoveredSlider.getMax())); - - tooltipManager.add(new Tooltip(hoveredSlider.getName() + ": " + percent + "%")); - hoveredSlider = null; - } - } - - @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent ev) - { - switch (ev.getEventName()) - { - case "optionsAllSounds": - // We have to override this script because it gets invoked periodically from the server - client.getIntStack()[client.getIntStackSize() - 1] = -1; - } - } - @Subscribe public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) { From e56ae31b2b7fca49998f815b56bc6b68ca3b536c Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 1 Dec 2020 20:25:18 -0700 Subject: [PATCH 044/173] Update WidgetID to 2020-12-2 --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 613beda0ca..78346fbee4 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -147,7 +147,7 @@ public class WidgetID public static final int SEED_BOX_GROUP_ID = 128; public static final int SEED_VAULT_GROUP_ID = 631; public static final int EXPLORERS_RING_ALCH_GROUP_ID = 483; - public static final int OPTIONS_GROUP_ID = 261; + public static final int OPTIONS_GROUP_ID = 116; public static final int GWD_KC_GROUP_ID = 406; public static final int LMS_GROUP_ID = 333; public static final int LMS_INGAME_GROUP_ID = 328; @@ -882,10 +882,7 @@ public class WidgetID static class Options { - static final int CAMERA_ZOOM_SLIDER_HANDLE = 15; - static final int MUSIC_SLIDER = 37; - static final int SOUND_EFFECT_SLIDER = 43; - static final int AREA_SOUND_SLIDER = 49; + static final int CAMERA_ZOOM_SLIDER_HANDLE = 55; } static class AchievementDiary From 898641fa79844e6f65129dd98f562aea015a6ad6 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Wed, 2 Dec 2020 03:15:19 -0700 Subject: [PATCH 045/173] rl-client: add new zoom update script --- .../scripts/NewOptionsPanelZoomListener.hash | 1 + .../NewOptionsPanelZoomListener.rs2asm | 75 +++++++++++++++ .../scripts/NewOptionsPanelZoomSetter.hash | 1 + .../scripts/NewOptionsPanelZoomSetter.rs2asm | 96 +++++++++++++++++++ .../scripts/NewOptionsPanelZoomSlider.hash | 1 + .../scripts/NewOptionsPanelZoomSlider.rs2asm | 78 +++++++++++++++ 6 files changed, 252 insertions(+) create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomListener.hash create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomListener.rs2asm create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.hash create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.rs2asm create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.hash create mode 100644 runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.rs2asm diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.hash b/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.hash new file mode 100644 index 0000000000..83a3a4c586 --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.hash @@ -0,0 +1 @@ +5464D17DCD348F352EFFE6AA6AEEC5A5609ECBA30EAC2CB2B3D479D2C0DDDA9A \ No newline at end of file diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.rs2asm b/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.rs2asm new file mode 100644 index 0000000000..1763832ed6 --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomListener.rs2asm @@ -0,0 +1,75 @@ +.id 3898 +.int_stack_count 6 +.string_stack_count 0 +.int_var_count 11 +.string_var_count 0 + get_varbit 4606 + iconst 0 + if_icmpne LABEL4 + jump LABEL5 +LABEL4: + return +LABEL5: + iconst 512 + istore 6 + iconst 512 + istore 7 + iload 2 + iconst 16 + sub + istore 8 + iconst 0 + iload 3 + invoke 1045 + istore 3 + iload 2 + iconst 16 + sub + iload 3 + invoke 1046 + istore 3 + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + istore 9 + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + istore 10 + iload 3 + iload 9 + multiply + iload 8 + div + iconst 128 + sconst "outerZoomLimit" + runelite_callback + add + istore 6 + iload 3 + iload 10 + multiply + iload 8 + div + iconst 128 + sconst "outerZoomLimit" + runelite_callback + add + istore 7 + iload 0 + iload 1 + iload 7 + iload 6 + iload 2 + iload 4 + iload 5 + invoke 3899 + return diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.hash b/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.hash new file mode 100644 index 0000000000..e6ff467a74 --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.hash @@ -0,0 +1 @@ +AA98471D04D9CB1172253D0B479EFD2D58394BDD2852F3AE8CD2B2D46FA826C3 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.rs2asm b/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.rs2asm new file mode 100644 index 0000000000..aef3b1ab39 --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomSetter.rs2asm @@ -0,0 +1,96 @@ +.id 3899 +.int_stack_count 7 +.string_stack_count 0 +.int_var_count 11 +.string_var_count 0 + get_varbit 4606 + iconst 0 + if_icmpne LABEL4 + jump LABEL5 +LABEL4: + return +LABEL5: + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iload 2 + invoke 1046 + istore 2 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + iload 2 + invoke 1045 + istore 2 + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iload 3 + invoke 1046 + istore 3 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + iload 3 + invoke 1045 + istore 3 + iload 2 + iload 3 + viewport_setfov + iconst 0 + istore 7 + iconst 0 + istore 8 + viewport_geteffectivesize + istore 8 + istore 7 + iload 8 + iconst 334 + sub + istore 9 + iload 9 + iconst 0 + if_icmplt LABEL39 + jump LABEL42 +LABEL39: + iconst 0 + istore 9 + jump LABEL48 +LABEL42: + iload 9 + iconst 100 + if_icmpgt LABEL46 + jump LABEL48 +LABEL46: + iconst 100 + istore 9 +LABEL48: + iload 2 + iload 3 + iload 2 + sub + iload 9 + multiply + iconst 100 + div + add + istore 10 + iconst 25 + iconst 25 + iload 10 + multiply + iconst 256 + div + add + cam_setfollowheight + iload 2 + iload 3 + set_varc_int 74 + set_varc_int 73 + iload 0 + iload 1 + iload 4 + iload 5 + iload 6 + invoke 3900 + return diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.hash b/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.hash new file mode 100644 index 0000000000..6b984c313e --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.hash @@ -0,0 +1 @@ +03D7F1AF9E8405CB4A74779254E8C65563123F865CC0181186238B038A740755 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.rs2asm b/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.rs2asm new file mode 100644 index 0000000000..84406d0edc --- /dev/null +++ b/runelite-client/src/main/scripts/NewOptionsPanelZoomSlider.rs2asm @@ -0,0 +1,78 @@ +.id 3900 +.int_stack_count 5 +.string_stack_count 0 +.int_var_count 11 +.string_var_count 0 + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + istore 5 + iconst 896 + sconst "innerZoomLimit" + runelite_callback + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + istore 6 + iload 2 + iconst 16 + sub + istore 7 + iconst 0 + istore 8 + iconst 0 + istore 9 + viewport_geteffectivesize + istore 9 + istore 8 + iconst 0 + istore 10 + iload 8 + iconst 334 + if_icmpgt LABEL25 + jump LABEL34 +LABEL25: + get_varc_int 74 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + iload 7 + multiply + iload 5 + div + istore 10 + jump LABEL42 +LABEL34: + get_varc_int 73 + iconst 128 + sconst "outerZoomLimit" + runelite_callback + sub + iload 7 + multiply + iload 6 + div + istore 10 +LABEL42: + iload 0 + iload 1 + cc_find + iconst 1 + if_icmpeq LABEL48 + jump LABEL55 +LABEL48: + iload 4 + iload 10 + add + iload 3 + iconst 0 + iconst 0 + cc_setposition +LABEL55: + return From eb1f86f6cbeee17b55de62c28d3a26553264e1e0 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 2 Dec 2020 12:21:27 +0000 Subject: [PATCH 046/173] Release 1.6.33 --- 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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 00b52e85cf..a77c3a52a8 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 0b245b847f..c86f559098 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 982d5222c8..659ea99207 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 288ab73034..283f11df6d 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 6844981f82..6d624a0a8b 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 Web Service diff --git a/pom.xml b/pom.xml index 27477cc8c3..a173df57e6 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.6.33 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 791d706c78..0b8f65dd50 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index a73e4c5192..b44252e9c6 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 0c468b5907..cda5009b96 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33-SNAPSHOT + 1.6.33 script-assembler-plugin From ed591b123b236b0432285d9979a387b3e0de5f34 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 2 Dec 2020 12:21:36 +0000 Subject: [PATCH 047/173] Bump for 1.6.34-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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index a77c3a52a8..01ba078ab9 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index c86f559098..b5733dc74b 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 659ea99207..3cf7676ba7 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 283f11df6d..c0c3d01c06 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 6d624a0a8b..dc9b9315ff 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index a173df57e6..c67bfb3715 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.6.33 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 0b8f65dd50..1af56d1208 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index b44252e9c6..524d9de239 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index cda5009b96..bf5681f157 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.33 + 1.6.34-SNAPSHOT script-assembler-plugin From 16149cdcae0971a62067c84956f2e06fdb712e03 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 2 Dec 2020 19:19:28 -0500 Subject: [PATCH 048/173] config manager: manually parse config keys The regex used took too long to complete with large inputs that can appear when the user has a corrupted config. --- .../runelite/client/config/ConfigManager.java | 98 ++++++++++++------- .../client/config/ConfigManagerTest.java | 12 +-- 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 95bde475aa..01d8ebfe1d 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -112,11 +112,9 @@ public class ConfigManager private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); - @VisibleForTesting - static final Pattern KEY_SPLITTER = Pattern.compile("([^.]+)\\.(?:(" + RSPROFILE_GROUP + "\\.[^.]+)\\.)?(.*)"); - private static final int KEY_SPLITTER_GROUP = 1; - private static final int KEY_SPLITTER_PROFILE = 2; - private static final int KEY_SPLITTER_KEY = 3; + private static final int KEY_SPLITTER_GROUP = 0; + private static final int KEY_SPLITTER_PROFILE = 1; + private static final int KEY_SPLITTER_KEY = 2; private final File settingsFileInput; private final EventBus eventBus; @@ -229,15 +227,15 @@ public class ConfigManager { log.debug("Loading configuration value from client {}: {}", entry.getKey(), entry.getValue()); - Matcher matcher = KEY_SPLITTER.matcher(entry.getKey()); - if (!matcher.find()) + String[] split = splitKey(entry.getKey()); + if (split == null) { continue; } - final String groupName = matcher.group(KEY_SPLITTER_GROUP); - final String profile = matcher.group(KEY_SPLITTER_PROFILE); - final String key = matcher.group(KEY_SPLITTER_KEY); + final String groupName = split[KEY_SPLITTER_GROUP]; + final String profile = split[KEY_SPLITTER_PROFILE]; + final String key = split[KEY_SPLITTER_KEY]; final String value = entry.getValue(); final String oldValue = (String) properties.setProperty(entry.getKey(), value); @@ -282,30 +280,30 @@ public class ConfigManager { if (!properties.containsKey(wholeKey)) { - Matcher matcher = KEY_SPLITTER.matcher(wholeKey); - if (!matcher.find()) + String[] split = splitKey(wholeKey); + if (split == null) { return; } - String groupName = matcher.group(KEY_SPLITTER_GROUP); - String profile = matcher.group(KEY_SPLITTER_PROFILE); - String key = matcher.group(KEY_SPLITTER_KEY); + String groupName = split[KEY_SPLITTER_GROUP]; + String profile = split[KEY_SPLITTER_PROFILE]; + String key = split[KEY_SPLITTER_KEY]; unsetConfiguration(groupName, profile, key); } }); properties.forEach((wholeKey, objValue) -> { - Matcher matcher = KEY_SPLITTER.matcher((String) wholeKey); - if (!matcher.find()) + String[] split = splitKey((String) wholeKey); + if (split == null) { return; } - String groupName = matcher.group(KEY_SPLITTER_GROUP); - String profile = matcher.group(KEY_SPLITTER_PROFILE); - String key = matcher.group(KEY_SPLITTER_KEY); + String groupName = split[KEY_SPLITTER_GROUP]; + String profile = split[KEY_SPLITTER_PROFILE]; + String key = split[KEY_SPLITTER_KEY]; String value = String.valueOf(objValue); setConfiguration(groupName, profile, key, value); }); @@ -361,17 +359,17 @@ public class ConfigManager Map copy = (Map) ImmutableMap.copyOf(properties); copy.forEach((wholeKey, value) -> { - Matcher matcher = KEY_SPLITTER.matcher(wholeKey); - if (!matcher.find()) + String[] split = splitKey(wholeKey); + if (split == null) { log.debug("Properties key malformed!: {}", wholeKey); properties.remove(wholeKey); return; } - String groupName = matcher.group(KEY_SPLITTER_GROUP); - String profile = matcher.group(KEY_SPLITTER_PROFILE); - String key = matcher.group(KEY_SPLITTER_KEY); + String groupName = split[KEY_SPLITTER_GROUP]; + String profile = split[KEY_SPLITTER_PROFILE]; + String key = split[KEY_SPLITTER_KEY]; ConfigChanged configChanged = new ConfigChanged(); configChanged.setGroup(groupName); @@ -937,13 +935,13 @@ public class ConfigManager continue; } - Matcher m = KEY_SPLITTER.matcher(key); - if (!m.find()) + String[] split = splitKey(key); + if (split == null) { continue; } - profileKeys.add(m.group(KEY_SPLITTER_PROFILE)); + profileKeys.add(split[KEY_SPLITTER_PROFILE]); } return profileKeys.stream() @@ -1061,6 +1059,34 @@ public class ConfigManager } } + /** + * Split a config key into (group, profile, key) + * @param key in form group.(rsprofile.profile.)?key + * @return an array of {group, profile, key} + */ + @VisibleForTesting + @Nullable + static String[] splitKey(String key) + { + int i = key.indexOf('.'); + if (i == -1) + { + // all keys must have a group and key + return null; + } + + String group = key.substring(0, i); + String profile = null; + key = key.substring(i + 1); + if (key.startsWith(RSPROFILE_GROUP + ".")) + { + i = key.indexOf('.', RSPROFILE_GROUP.length() + 2); // skip . after RSPROFILE_GROUP + profile = key.substring(0, i); + key = key.substring(i + 1); + } + return new String[]{group, profile, key}; + } + private synchronized void migrateConfig() { String migrationKey = "profileMigrationDone"; @@ -1108,20 +1134,20 @@ public class ConfigManager String profKey = profiles.computeIfAbsent(username, u -> findRSProfile(getRSProfiles(), u, RuneScapeProfileType.STANDARD, u, true).getKey()); - Matcher oldKeyM = KEY_SPLITTER.matcher(oldkey); - if (!oldKeyM.find()) + String[] oldKeySplit = splitKey(oldkey); + if (oldKeySplit == null) { log.warn("skipping migration of invalid key \"{}\"", oldkey); return false; } - if (oldKeyM.group(KEY_SPLITTER_PROFILE) != null) + if (oldKeySplit[KEY_SPLITTER_PROFILE] != null) { log.debug("skipping migrated key \"{}\"", oldkey); return false; } - Matcher newKeyM = KEY_SPLITTER.matcher(newKey); - if (!newKeyM.find() || newKeyM.group(KEY_SPLITTER_PROFILE) != null) + String[] newKeySplit = splitKey(newKey); + if (newKeySplit == null || newKeySplit[KEY_SPLITTER_PROFILE] != null) { log.warn("migration produced a bad key: \"{}\" -> \"{}\"", oldkey, newKey); return false; @@ -1142,10 +1168,10 @@ public class ConfigManager } } - String oldGroup = oldKeyM.group(KEY_SPLITTER_GROUP); - String oldKeyPart = oldKeyM.group(KEY_SPLITTER_KEY); + String oldGroup = oldKeySplit[KEY_SPLITTER_GROUP]; + String oldKeyPart = oldKeySplit[KEY_SPLITTER_KEY]; String value = getConfiguration(oldGroup, oldKeyPart); - setConfiguration(newKeyM.group(KEY_SPLITTER_GROUP), profKey, newKeyM.group(KEY_SPLITTER_KEY), value); + setConfiguration(newKeySplit[KEY_SPLITTER_GROUP], profKey, newKeySplit[KEY_SPLITTER_KEY], value); unsetConfiguration(oldGroup, oldKeyPart); return true; }); diff --git a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java index 9c9fd79871..4f384e83ec 100644 --- a/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/config/ConfigManagerTest.java @@ -32,7 +32,6 @@ import java.io.IOException; import java.time.Instant; import java.util.UUID; import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; import javax.inject.Inject; import javax.inject.Named; import net.runelite.api.Client; @@ -40,6 +39,7 @@ import net.runelite.client.RuneLite; import net.runelite.client.account.AccountSession; import net.runelite.client.eventbus.EventBus; import org.junit.Assert; +import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -153,11 +153,11 @@ public class ConfigManagerTest }) { String whole = ConfigManager.getWholeKey(test[0], test[1], test[2]); - Matcher m = ConfigManager.KEY_SPLITTER.matcher(whole); - Assert.assertTrue(m.find()); - Assert.assertEquals(m.group(1), test[0]); - Assert.assertEquals(m.group(2), test[1]); - Assert.assertEquals(m.group(3), test[2]); + String[] split = ConfigManager.splitKey(whole); + assertNotNull(split); + Assert.assertEquals(split[0], test[0]); + Assert.assertEquals(split[1], test[1]); + Assert.assertEquals(split[2], test[2]); } } } From 316a19147c2f9dbfc824e7e3100b0d7d0cc14cb4 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 3 Dec 2020 11:37:41 -0500 Subject: [PATCH 049/173] Fix Javadoc search feature to work without modules --- pom.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c67bfb3715..25f1b102b7 100644 --- a/pom.xml +++ b/pom.xml @@ -200,8 +200,6 @@ maven-release-plugin 2.5.3 - org.apache.maven.plugins maven-javadoc-plugin @@ -209,7 +207,12 @@ 8 + + --no-module-directories + attach-javadocs From f5a76e996116cd3037e292e7ece865d5f8fb036c Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 3 Dec 2020 15:50:54 -0500 Subject: [PATCH 050/173] clientui: fix double requestFocusInWindow() when showing frame requestFocus() always calls giveClientFocus() in addition to requesting focus, so it is not necessary to call giveClientFocus() separately on startup. --- .../src/main/java/net/runelite/client/ui/ClientUI.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index a25b194d56..fdde73c995 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -570,7 +570,6 @@ public class ClientUI frame.setVisible(true); frame.toFront(); requestFocus(); - giveClientFocus(); log.info("Showing frame {}", frame); frame.revalidateMinimumSize(); }); From 3771444b7f49b61b4b48d6d3b034ce2bae7fa1ac Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 4 Dec 2020 15:50:21 -0500 Subject: [PATCH 051/173] chat commands: fix detecting pb when completing leagues tasks The league task message is in between the kc and pb messages, so just look for the pb message on the same tick as the kc message --- .../plugins/chatcommands/ChatCommandsPlugin.java | 10 +++++++++- .../chatcommands/ChatCommandsPluginTest.java | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index d35214805a..9f24c06faa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -137,6 +137,7 @@ public class ChatCommandsPlugin extends Plugin private String pohOwner; private HiscoreEndpoint hiscoreEndpoint; // hiscore endpoint for current player private String lastBossKill; + private int lastBossTime = -1; private int lastPb = -1; @Inject @@ -197,6 +198,7 @@ public class ChatCommandsPlugin extends Plugin public void shutDown() { lastBossKill = null; + lastBossTime = -1; keyManager.unregisterKeyListener(chatKeyboardListener); @@ -279,6 +281,7 @@ public class ChatCommandsPlugin extends Plugin else { lastBossKill = boss; + lastBossTime = client.getTickCount(); } return; } @@ -310,6 +313,7 @@ public class ChatCommandsPlugin extends Plugin lastPb = -1; } lastBossKill = boss; + lastBossTime = client.getTickCount(); return; } @@ -428,7 +432,11 @@ public class ChatCommandsPlugin extends Plugin setKc("Hallowed Sepulchre", kc); } - lastBossKill = null; + if (lastBossKill != null && lastBossTime != client.getTickCount()) + { + lastBossKill = null; + lastBossTime = -1; + } } private static int timeStringToSeconds(String timeString) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 0145df8777..db008b2f34 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -679,4 +679,20 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("killcount", "hallowed sepulchre", 36); } + + @Test + public void testJadNewPbWithLeagueTask() + { + ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzTok-Jad kill count is: 2.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Congratulations, you've completed a master task: Complete the Fight Caves in 25:00.", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 21:58 (new personal best)", null, 0); + chatCommandsPlugin.onChatMessage(chatMessage); + + verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(21 * 60 + 58)); + verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tztok-jad"), eq(2)); + } } From f0233234dafa6bd5b52de57197f1d062884d9ec0 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 4 Dec 2020 16:01:50 -0500 Subject: [PATCH 052/173] chat commands test: remove unnecesary argument matchers --- .../chatcommands/ChatCommandsPluginTest.java | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index db008b2f34..72a9855bd7 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -259,7 +259,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("kree'arra"), eq(79)); + verify(configManager).setRSProfileConfiguration("personalbest", "kree'arra", 79); } @Test @@ -274,7 +274,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(55)); + verify(configManager).setRSProfileConfiguration("personalbest", "zulrah", 55); } @Test @@ -289,7 +289,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("kree'arra"), eq(181)); + verify(configManager).setRSProfileConfiguration("personalbest", "kree'arra", 181); } @Test @@ -332,8 +332,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("prifddinas agility course"), eq(61)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("prifddinas agility course"), eq(2)); + verify(configManager).setRSProfileConfiguration("personalbest", "prifddinas agility course", 61); + verify(configManager).setRSProfileConfiguration("killcount", "prifddinas agility course", 2); } @Test @@ -345,8 +345,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 104:31 (new personal best)", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tzkal-zuk"), eq(104 * 60 + 31)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tzkal-zuk"), eq(2)); + verify(configManager).setRSProfileConfiguration("personalbest", "tzkal-zuk", 104 * 60 + 31); + verify(configManager).setRSProfileConfiguration("killcount", "tzkal-zuk", 2); } @Test @@ -358,8 +358,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 172:18. Personal best: 134:52", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tzkal-zuk"), eq(134 * 60 + 52)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tzkal-zuk"), eq(3)); + verify(configManager).setRSProfileConfiguration("personalbest", "tzkal-zuk", 134 * 60 + 52); + verify(configManager).setRSProfileConfiguration("killcount", "tzkal-zuk", 3); } @Test @@ -371,8 +371,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 179.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(96)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("grotesque guardians"), eq(179)); + verify(configManager).setRSProfileConfiguration("personalbest", "grotesque guardians", 96); + verify(configManager).setRSProfileConfiguration("killcount", "grotesque guardians", 179); } @Test @@ -384,8 +384,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 32.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(2 * 60 + 14)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("grotesque guardians"), eq(32)); + verify(configManager).setRSProfileConfiguration("personalbest", "grotesque guardians", 2 * 60 + 14); + verify(configManager).setRSProfileConfiguration("killcount", "grotesque guardians", 32); } @Test @@ -397,8 +397,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("gauntlet"), eq(124)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("gauntlet"), eq(7 * 60 + 59)); + verify(configManager).setRSProfileConfiguration("killcount", "gauntlet", 124); + verify(configManager).setRSProfileConfiguration("personalbest", "gauntlet", 7 * 60 + 59); } @Test @@ -410,8 +410,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("gauntlet"), eq(10 * 60 + 24)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("gauntlet"), eq(124)); + verify(configManager).setRSProfileConfiguration("personalbest", "gauntlet", 10 * 60 + 24); + verify(configManager).setRSProfileConfiguration("killcount", "gauntlet", 124); } @Test @@ -423,8 +423,8 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 51.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("chambers of xeric"), eq(51)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(37 * 60 + 4)); + verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 51); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 37 * 60 + 4); } @Test @@ -453,7 +453,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("chambers of xeric"), eq(52)); + verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 52); verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), anyInt()); } @@ -500,14 +500,14 @@ public class ChatCommandsPluginTest chatCommandsPlugin.onWidgetLoaded(countersLogEvent); chatCommandsPlugin.onGameTick(new GameTick()); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(38 * 60 + 10)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(5 * 60 + 48)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("vorkath"), eq(1 * 60 + 21)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("grotesque guardians"), eq(2 * 60 + 49)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("hespori"), eq(57)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("nightmare"), eq(3 * 60 + 30)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(24 * 60 + 17)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric challenge mode"), eq(22 * 60 + 15)); + verify(configManager).setRSProfileConfiguration("personalbest", "tztok-jad", 38 * 60 + 10); + verify(configManager).setRSProfileConfiguration("personalbest", "zulrah", 5 * 60 + 48); + verify(configManager).setRSProfileConfiguration("personalbest", "vorkath", 1 * 60 + 21); + verify(configManager).setRSProfileConfiguration("personalbest", "grotesque guardians", 2 * 60 + 49); + verify(configManager).setRSProfileConfiguration("personalbest", "hespori", 57); + verify(configManager).setRSProfileConfiguration("personalbest", "nightmare", 3 * 60 + 30); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 24 * 60 + 17); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric challenge mode", 22 * 60 + 15); } @Test @@ -552,12 +552,12 @@ public class ChatCommandsPluginTest chatCommandsPlugin.onWidgetLoaded(countersLogEvent); chatCommandsPlugin.onGameTick(new GameTick()); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(65 * 60 + 12)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("zulrah"), eq(2 * 60 + 55)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("vorkath"), eq(1 * 60 + 37)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("hespori"), eq(1 * 60 + 42)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), eq(21 * 60 + 23)); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric challenge mode"), eq(21 * 60 + 26)); + verify(configManager).setRSProfileConfiguration("personalbest", "tztok-jad", 65 * 60 + 12); + verify(configManager).setRSProfileConfiguration("personalbest", "zulrah", 2 * 60 + 55); + verify(configManager).setRSProfileConfiguration("personalbest", "vorkath", 1 * 60 + 37); + verify(configManager).setRSProfileConfiguration("personalbest", "hespori", 1 * 60 + 42); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 21 * 60 + 23); + verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric challenge mode", 21 * 60 + 26); } @Test @@ -692,7 +692,7 @@ public class ChatCommandsPluginTest chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 21:58 (new personal best)", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); - verify(configManager).setRSProfileConfiguration(eq("personalbest"), eq("tztok-jad"), eq(21 * 60 + 58)); - verify(configManager).setRSProfileConfiguration(eq("killcount"), eq("tztok-jad"), eq(2)); + verify(configManager).setRSProfileConfiguration("personalbest", "tztok-jad", 21 * 60 + 58); + verify(configManager).setRSProfileConfiguration("killcount", "tztok-jad", 2); } } From 3bad0b726be8eac4119e8ff657ca3160ae11a074 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 6 Dec 2020 15:42:48 -0500 Subject: [PATCH 053/173] ba plugin: cleanup and remove unused code --- .../BarbarianAssaultPlugin.java | 22 +++++-------------- .../barbarianassault/HealerOverlay.java | 5 ----- .../client/plugins/barbarianassault/Role.java | 15 +++---------- .../plugins/barbarianassault/Round.java | 12 ++++------ .../barbarianassault/TimerOverlay.java | 5 ----- 5 files changed, 12 insertions(+), 47 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java index 7536a009c8..73eb79037d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java @@ -26,9 +26,9 @@ package net.runelite.client.plugins.barbarianassault; import com.google.inject.Provides; -import java.awt.Font; import java.awt.Image; import javax.inject.Inject; +import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; @@ -47,7 +47,6 @@ 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.ui.FontManager; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.util.ImageUtil; @@ -62,7 +61,7 @@ public class BarbarianAssaultPlugin extends Plugin private static final String START_WAVE = "1"; private static final String ENDGAME_REWARD_NEEDLE_TEXT = "
5"; - private Font font; + @Getter(AccessLevel.PACKAGE) private Image clockImage; private int inGameBit = 0; private String currentWave = START_WAVE; @@ -100,8 +99,6 @@ public class BarbarianAssaultPlugin extends Plugin { overlayManager.add(timerOverlay); overlayManager.add(healerOverlay); - font = FontManager.getRunescapeFont() - .deriveFont(Font.BOLD, 24); clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png"); } @@ -114,6 +111,7 @@ public class BarbarianAssaultPlugin extends Plugin gameTime = null; currentWave = START_WAVE; inGameBit = 0; + clockImage = null; } @Subscribe @@ -195,9 +193,9 @@ public class BarbarianAssaultPlugin extends Plugin announceTime("Wave " + currentWave + " duration: ", gameTime.getTime(true)); } } - } - inGameBit = inGame; + inGameBit = inGame; + } } private void setRound(Role role) @@ -225,14 +223,4 @@ public class BarbarianAssaultPlugin extends Plugin .runeLiteFormattedMessage(chatMessage) .build()); } - - public Font getFont() - { - return font; - } - - public Image getClockImage() - { - return clockImage; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/HealerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/HealerOverlay.java index 7a04cfb288..47b410c431 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/HealerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/HealerOverlay.java @@ -87,11 +87,6 @@ class HealerOverlay extends Overlay } Role role = round.getRoundRole(); - if (role == null) - { - return null; - } - if (config.showHealerBars() && role == Role.HEALER) { for (HealerTeam teammate : HealerTeam.values()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java index 58b047c829..a8fd8b656c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java @@ -24,9 +24,12 @@ */ package net.runelite.client.plugins.barbarianassault; +import lombok.AllArgsConstructor; import lombok.Getter; import net.runelite.api.widgets.WidgetInfo; +@AllArgsConstructor +@Getter enum Role { ATTACKER(WidgetInfo.BA_ATK_LISTEN_TEXT, WidgetInfo.BA_ATK_CALL_TEXT, WidgetInfo.BA_ATK_ROLE_TEXT, WidgetInfo.BA_ATK_ROLE_SPRITE), @@ -34,23 +37,11 @@ enum Role COLLECTOR(WidgetInfo.BA_COLL_LISTEN_TEXT, WidgetInfo.BA_COLL_CALL_TEXT, WidgetInfo.BA_COLL_ROLE_TEXT, WidgetInfo.BA_COLL_ROLE_SPRITE), HEALER(WidgetInfo.BA_HEAL_LISTEN_TEXT, WidgetInfo.BA_HEAL_CALL_TEXT, WidgetInfo.BA_HEAL_ROLE_TEXT, WidgetInfo.BA_HEAL_ROLE_SPRITE); - @Getter private final WidgetInfo listen; - @Getter private final WidgetInfo call; - @Getter private final WidgetInfo roleText; - @Getter private final WidgetInfo roleSprite; - Role(WidgetInfo listen, WidgetInfo call, WidgetInfo role, WidgetInfo roleSprite) - { - this.listen = listen; - this.call = call; - this.roleText = role; - this.roleSprite = roleSprite; - } - @Override public String toString() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Round.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Round.java index 9d13b74123..3ed8932a0a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Round.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Round.java @@ -28,6 +28,7 @@ import java.time.Duration; import java.time.Instant; import javax.inject.Inject; import lombok.Getter; +import lombok.NonNull; import lombok.Setter; import static net.runelite.client.util.RSTimeUnit.GAME_TICKS; @@ -50,19 +51,14 @@ class Round private boolean fightersKilled; @Inject - public Round(Role role) + public Round(@NonNull Role role) { this.roundRole = role; this.roundStartTime = Instant.now().plus(Duration.of(2, GAME_TICKS)); } - public long getRoundTime() + public int getTimeToChange() { - return Duration.between(roundStartTime, Instant.now()).getSeconds(); - } - - public long getTimeToChange() - { - return 30 + (Duration.between(Instant.now(), roundStartTime).getSeconds() % 30); + return 30 + ((int) Duration.between(Instant.now(), roundStartTime).getSeconds() % 30); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerOverlay.java index ecaa420ff7..59a0aa6cd2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerOverlay.java @@ -65,11 +65,6 @@ class TimerOverlay extends Overlay } Role role = round.getRoundRole(); - if (role == null) - { - return null; - } - Widget roleText = client.getWidget(role.getRoleText()); Widget roleSprite = client.getWidget(role.getRoleSprite()); From e47a79db13ae0d776a25d2a72b152f8f57fa37a7 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 4 Dec 2020 16:37:15 -0700 Subject: [PATCH 054/173] runelite-api: add param accessors --- .../main/java/net/runelite/api/Client.java | 12 ++++ .../net/runelite/api/ItemComposition.java | 2 +- .../net/runelite/api/IterableHashTable.java | 1 + .../java/net/runelite/api/NPCComposition.java | 2 +- .../net/runelite/api/ObjectComposition.java | 2 +- .../java/net/runelite/api/ParamHolder.java | 57 +++++++++++++++++++ .../main/java/net/runelite/api/ParamID.java | 32 +++++++++++ .../net/runelite/api/StructComposition.java | 38 +++++++++++++ .../main/java/net/runelite/api/StructID.java | 34 +++++++++++ .../api/events/PostStructComposition.java | 41 +++++++++++++ 10 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/ParamHolder.java create mode 100644 runelite-api/src/main/java/net/runelite/api/ParamID.java create mode 100644 runelite-api/src/main/java/net/runelite/api/StructComposition.java create mode 100644 runelite-api/src/main/java/net/runelite/api/StructID.java create mode 100644 runelite-api/src/main/java/net/runelite/api/events/PostStructComposition.java diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 93d2c2ef81..7c75f6ace8 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -897,6 +897,18 @@ public interface Client extends GameEngine */ NPCComposition getNpcDefinition(int npcId); + /** + * Gets the {@link StructComposition} for a given struct ID + * + * @see StructID + */ + StructComposition getStructComposition(int structID); + + /** + * Gets the client's cache of in memory struct compositions + */ + NodeCache getStructCompositionCache(); + /** * Gets an array of all world areas * diff --git a/runelite-api/src/main/java/net/runelite/api/ItemComposition.java b/runelite-api/src/main/java/net/runelite/api/ItemComposition.java index 72f955e5ba..37407724cb 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemComposition.java @@ -29,7 +29,7 @@ import javax.annotation.Nullable; /** * Represents the template of a specific item type. */ -public interface ItemComposition +public interface ItemComposition extends ParamHolder { /** * Gets the items name. diff --git a/runelite-api/src/main/java/net/runelite/api/IterableHashTable.java b/runelite-api/src/main/java/net/runelite/api/IterableHashTable.java index 48894f1863..016888cc80 100644 --- a/runelite-api/src/main/java/net/runelite/api/IterableHashTable.java +++ b/runelite-api/src/main/java/net/runelite/api/IterableHashTable.java @@ -27,4 +27,5 @@ package net.runelite.api; public interface IterableHashTable extends Iterable { T get(long hash); + void put(T node, long hash); } diff --git a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java index d61ef4b670..faff1da7db 100644 --- a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java @@ -27,7 +27,7 @@ package net.runelite.api; /** * Information about a specific {@link NpcID} */ -public interface NPCComposition +public interface NPCComposition extends ParamHolder { /** * Gets the name of the NPC. diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java b/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java index 43fa5aa88a..1d0357b78a 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java @@ -27,7 +27,7 @@ package net.runelite.api; /** * Information about a specific {@link ObjectID} */ -public interface ObjectComposition +public interface ObjectComposition extends ParamHolder { /** * Gets ID for the object. diff --git a/runelite-api/src/main/java/net/runelite/api/ParamHolder.java b/runelite-api/src/main/java/net/runelite/api/ParamHolder.java new file mode 100644 index 0000000000..694a9448f0 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/ParamHolder.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Abex + * 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.api; + +/** + * A composition that can hold `param` keys. This lets Jagex attach arbitrary constant + * data to certain items, objects, npcs, or structs for use in cs2 + * + * @see ParamID + */ +public interface ParamHolder +{ + IterableHashTable getParams(); + void setParams(IterableHashTable params); + + /** + * Gets the value of a given {@link ParamID}, or its default if it is unset + */ + int getIntValue(int paramID); + + /** + * Sets the value of a given {@link ParamID} + */ + void setValue(int paramID, int value); + + /** + * Gets the value of a given {@link ParamID}, or its default if it is unset + */ + String getStringValue(int paramID); + + /** + * Sets the value of a given {@link ParamID} + */ + void setValue(int paramID, String value); +} diff --git a/runelite-api/src/main/java/net/runelite/api/ParamID.java b/runelite-api/src/main/java/net/runelite/api/ParamID.java new file mode 100644 index 0000000000..0775cf9f26 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/ParamID.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 Abex + * 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.api; + +/** + * @see ParamHolder + */ +public class ParamID +{ +} diff --git a/runelite-api/src/main/java/net/runelite/api/StructComposition.java b/runelite-api/src/main/java/net/runelite/api/StructComposition.java new file mode 100644 index 0000000000..b395a3beb2 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/StructComposition.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Abex + * 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.api; + +/** + * A config type dedicated to holding params. + * + * Historically items were often used for this before structs were made + * available, and there are many of these still around. + * + * @see ParamHolder + */ +public interface StructComposition extends ParamHolder +{ + int getId(); +} diff --git a/runelite-api/src/main/java/net/runelite/api/StructID.java b/runelite-api/src/main/java/net/runelite/api/StructID.java new file mode 100644 index 0000000000..dd3c148cd3 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/StructID.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Abex + * 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.api; + +/** + * @see StructComposition + * @see Client#getStructComposition(int) + */ +public class StructID +{ +} diff --git a/runelite-api/src/main/java/net/runelite/api/events/PostStructComposition.java b/runelite-api/src/main/java/net/runelite/api/events/PostStructComposition.java new file mode 100644 index 0000000000..82238e94fd --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/PostStructComposition.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 Abex + * 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.api.events; + +import lombok.Data; +import net.runelite.api.StructComposition; + +/** + * An event called after a new {@link StructComposition} is created and + * its data is initialized. + */ +@Data +public class PostStructComposition +{ + /** + * The newly created struct. + */ + private StructComposition structComposition; +} From 6056b92faf32ecc537785e1bd121df5c93f64918 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 4 Dec 2020 16:39:36 -0700 Subject: [PATCH 055/173] runelite-api: add various widget accessors --- .../main/java/net/runelite/api/Client.java | 14 +++++++++ .../java/net/runelite/api/widgets/Widget.java | 31 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 7c75f6ace8..3bf027952b 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1156,6 +1156,20 @@ public interface Client extends GameEngine */ String[] getStringStack(); + /** + * Gets the cs2 vm's active widget + * + * This is used for all {@code cc_*} operations with a {@code 0} operand + */ + Widget getScriptActiveWidget(); + + /** + * Gets the cs2 vm's "dot" widget + * + * This is used for all {@code .cc_*} operations with a {@code 1} operand + */ + Widget getScriptDotWidget(); + /** * Checks whether a player is on the friends list. * diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java index 5b7cdec58d..e1d101d8ee 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/Widget.java @@ -972,4 +972,35 @@ public interface Widget * @param args A ScriptID, then the args for the script */ void setOnReleaseListener(Object ...args); + + /** + * Sets a script to be ran when a drag operation is finished on this widget + * + * @param args A ScriptID, then the args for the script + */ + void setOnDragCompleteListener(Object ...args); + + /** + * Sets a script to be ran when this widget moves due to a drag + * + * @param args A ScriptID, then the args for the script + */ + void setOnDragListener(Object ...args); + + /** + * Container this can be dragged in + */ + Widget getDragParent(); + + /** + * Container this can be dragged in + */ + void setDragParent(Widget dragParent); + + /** + * Sets a script to be ran when a varplayer changes + * + * @param args A ScriptID, then the args for the script + */ + void setOnVarTransmitListener(Object ...args); } From 54f953dc42ca5d9f31ab4c56138dd35597b639c6 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 6 Dec 2020 19:20:05 -0700 Subject: [PATCH 056/173] runelite-api: allow running scripts with a widget source --- .../main/java/net/runelite/api/Client.java | 10 +++++++++ .../java/net/runelite/api/ScriptEvent.java | 21 +++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 3bf027952b..f33514e899 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1337,11 +1337,21 @@ public interface Client extends GameEngine * * This method must be ran on the client thread and is not reentrant * + * This method is shorthand for {@code client.createScriptEvent(args).run()} + * * @param args the script id, then any additional arguments to execute the script with * @see ScriptID */ void runScript(Object... args); + /** + * Creates a blank ScriptEvent for executing a ClientScript2 script + * + * @param args the script id, then any additional arguments to execute the script with + * @see ScriptID + */ + ScriptEvent createScriptEvent(Object ...args); + /** * Checks whether or not there is any active hint arrow. * diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java index e97061f1f9..2436c9ac3b 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptEvent.java @@ -40,13 +40,19 @@ public interface ScriptEvent String NAME = "event_opbase"; /** - * Gets the widget of the event. - * - * @return the widget - * @see net.runelite.api.widgets.Widget + * Gets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args + * are substituted with */ Widget getSource(); + /** + * Sets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args + * are substituted with. This is useful for running widget listeners + * + * @see Widget#getOnLoadListener() + */ + ScriptEvent setSource(Widget widget); + /** * Gets the menu index of the event * @@ -80,4 +86,11 @@ public interface ScriptEvent * @return */ int getTypedKeyChar(); + + /** + * Executes a cs2 script specified by this event + * + * This method must be ran on the client thread and is not reentrant + */ + void run(); } From 7840bb2b184b1fb08e8e03a4319a42b0e45ec0ae Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 3 Dec 2020 00:44:46 -0700 Subject: [PATCH 057/173] devtools: add dragParent to widget inspector --- .../client/plugins/devtools/WidgetField.java | 4 ++++ .../devtools/WidgetInfoTableModel.java | 1 + .../plugins/devtools/WidgetInspector.java | 21 +++++++++++++++++++ .../plugins/devtools/WidgetTreeNode.java | 21 +------------------ 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java index a4b21cb94d..cc92dd9fd5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java @@ -64,6 +64,10 @@ public class WidgetField { return value; } + if (value instanceof Widget) + { + return WidgetInspector.getWidgetIdentifier((Widget) value); + } return MessageFormatter.format("{}", value).getMessage(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java index a08323eba3..2b515e5fb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java @@ -193,6 +193,7 @@ public class WidgetInfoTableModel extends AbstractTableModel out.add(new WidgetField<>("NoClickThrough", Widget::getNoClickThrough, Widget::setNoClickThrough, Boolean.class)); out.add(new WidgetField<>("NoScrollThrough", Widget::getNoScrollThrough, Widget::setNoScrollThrough, Boolean.class)); out.add(new WidgetField<>("TargetVerb", Widget::getTargetVerb, Widget::setTargetVerb, String.class)); + out.add(new WidgetField<>("DragParent", Widget::getDragParent)); return out; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java index 7407711d58..2e99bc3a97 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java @@ -59,6 +59,8 @@ import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; import net.runelite.api.SpriteID; +import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; +import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; @@ -578,4 +580,23 @@ class WidgetInspector extends JFrame return null; } + + public static String getWidgetIdentifier(Widget widget) + { + int id = widget.getId(); + String str = TO_GROUP(id) + "." + TO_CHILD(id); + + if (widget.getIndex() != -1) + { + str += "[" + widget.getIndex() + "]"; + } + + WidgetInfo info = WidgetInspector.getWidgetInfo(id); + if (info != null) + { + str += " " + info.name(); + } + + return str; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java index 6b7526637a..c82a4d775e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java @@ -26,9 +26,6 @@ package net.runelite.client.plugins.devtools; import javax.swing.tree.DefaultMutableTreeNode; import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; class WidgetTreeNode extends DefaultMutableTreeNode { @@ -48,22 +45,6 @@ class WidgetTreeNode extends DefaultMutableTreeNode @Override public String toString() { - Widget widget = getWidget(); - - int id = widget.getId(); - String str = type + " " + TO_GROUP(id) + "." + TO_CHILD(id); - - if (widget.getIndex() != -1) - { - str += "[" + widget.getIndex() + "]"; - } - - WidgetInfo info = WidgetInspector.getWidgetInfo(id); - if (info != null) - { - str += " " + info.name(); - } - - return str; + return type + " " + WidgetInspector.getWidgetIdentifier(getWidget()); } } From 07819bd9a479f449b4e322ea7056af07ae014d68 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 4 Dec 2020 09:06:42 -0700 Subject: [PATCH 058/173] rl-api, rl-client: add Client::getWidget(I) --- .../src/main/java/net/runelite/api/Client.java | 10 ++++++++++ .../net/runelite/client/plugins/bank/BankPlugin.java | 4 +--- .../client/plugins/devtools/WidgetInspector.java | 4 ++-- .../client/plugins/experiencedrop/XpDropPlugin.java | 4 +--- .../net/runelite/client/plugins/wiki/WikiPlugin.java | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index f33514e899..580b16b1f3 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -502,6 +502,16 @@ public interface Client extends GameEngine @Nullable Widget getWidget(int groupId, int childId); + /** + * Gets a widget by it's packed ID. + * + *

+ * Note: Use {@link #getWidget(WidgetInfo)} or {@link #getWidget(int, int)} for + * a more readable version of this method. + */ + @Nullable + Widget getWidget(int packedID); + /** * Gets an array containing the x-axis canvas positions * of all widgets. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java index e0e1efbd5c..5b8ea483d6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java @@ -56,8 +56,6 @@ import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.config.Keybind; @@ -226,7 +224,7 @@ public class BankPlugin extends Plugin final int compId = intStack[intStackSize - 2]; final int buttonId = intStack[intStackSize - 1]; - Widget button = client.getWidget(TO_GROUP(compId), TO_CHILD(compId)); + Widget button = client.getWidget(compId); Widget buttonRect = button.getChild(0); final Object[] onOpListener = buttonRect.getOnOpListener(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java index 2e99bc3a97..986ebb996a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java @@ -564,7 +564,7 @@ class WidgetInspector extends JFrame { if (type == MenuAction.SPELL_CAST_ON_WIDGET.getId()) { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(param1), WidgetInfo.TO_CHILD(param1)); + Widget w = client.getWidget(param1); if (param0 != -1) { w = w.getChild(param0); @@ -574,7 +574,7 @@ class WidgetInspector extends JFrame } else if (type == MenuAction.ITEM_USE_ON_WIDGET.getId()) { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(param1), WidgetInfo.TO_CHILD(param1)); + Widget w = client.getWidget(param1); return w.getWidgetItem(param0); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java index 0c2497cf3b..c3b9523f21 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java @@ -43,8 +43,6 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.ScriptPreFired; import net.runelite.api.events.StatChanged; import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; @@ -92,7 +90,7 @@ public class XpDropPlugin extends Plugin private void processXpDrop(int widgetId) { - final Widget xpdrop = client.getWidget(TO_GROUP(widgetId), TO_CHILD(widgetId)); + final Widget xpdrop = client.getWidget(widgetId); final Widget[] children = xpdrop.getChildren(); // child 0 is the xpdrop text, everything else are sprite ids for skills final Widget text = children[0]; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index dce174eeee..2f0609bcfe 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -345,7 +345,7 @@ public class WikiPlugin extends Plugin private Widget getWidget(int wid, int index) { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); + Widget w = client.getWidget(wid); if (index != -1) { w = w.getChild(index); From b5b9da1a416b7cb70a9e92687ac2f51d500c2032 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 3 Dec 2020 00:46:59 -0700 Subject: [PATCH 059/173] runelite-api: rename Options group to SettingsSide --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 5 +++-- .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 2 +- .../net/runelite/client/plugins/camera/CameraOverlay.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 78346fbee4..7437371b70 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -147,7 +147,8 @@ public class WidgetID public static final int SEED_BOX_GROUP_ID = 128; public static final int SEED_VAULT_GROUP_ID = 631; public static final int EXPLORERS_RING_ALCH_GROUP_ID = 483; - public static final int OPTIONS_GROUP_ID = 116; + public static final int SETTINGS_SIDE_GROUP_ID = 116; + public static final int SETTINGS_GROUP_ID = 134; public static final int GWD_KC_GROUP_ID = 406; public static final int LMS_GROUP_ID = 333; public static final int LMS_INGAME_GROUP_ID = 328; @@ -880,7 +881,7 @@ public class WidgetID static final int INVENTORY = 7; } - static class Options + static class SettingsSide { static final int CAMERA_ZOOM_SLIDER_HANDLE = 55; } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 9205b8d1e2..1aa7b4d15f 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -532,7 +532,7 @@ public enum WidgetInfo SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT), SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER), - OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.CAMERA_ZOOM_SLIDER_HANDLE), + SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_HANDLE), ACHIEVEMENT_DIARY_CONTAINER(WidgetID.ACHIEVEMENT_DIARY_GROUP_ID, WidgetID.AchievementDiary.CONTAINER), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java index f379d60cb2..1616cdf1e5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java @@ -57,7 +57,7 @@ class CameraOverlay extends Overlay @Override public Dimension render(final Graphics2D graphics) { - final Widget slider = client.getWidget(WidgetInfo.OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE); + final Widget slider = client.getWidget(WidgetInfo.SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_HANDLE); final Point mousePos = client.getMouseCanvasPosition(); if (slider == null || slider.isHidden() || !slider.getBounds().contains(mousePos.getX(), mousePos.getY())) From 1076272d8d9ade5877cac63fdc47a756cab50fb8 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sat, 5 Dec 2020 03:44:59 -0700 Subject: [PATCH 060/173] music: re-add slider granularity removed in e60c25be994018f12a53ee35fe117f8a3fe60f45 --- .../main/java/net/runelite/api/ParamID.java | 16 + .../main/java/net/runelite/api/ScriptID.java | 19 +- .../main/java/net/runelite/api/SettingID.java | 35 ++ .../main/java/net/runelite/api/SpriteID.java | 4 + .../main/java/net/runelite/api/StructID.java | 3 + .../main/java/net/runelite/api/Varbits.java | 7 + .../net/runelite/api/widgets/WidgetID.java | 11 + .../net/runelite/api/widgets/WidgetInfo.java | 5 + .../client/plugins/music/MusicConfig.java | 13 + .../client/plugins/music/MusicPlugin.java | 534 ++++++++++++++++++ 10 files changed, 646 insertions(+), 1 deletion(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/SettingID.java diff --git a/runelite-api/src/main/java/net/runelite/api/ParamID.java b/runelite-api/src/main/java/net/runelite/api/ParamID.java index 0775cf9f26..9be05d76ef 100644 --- a/runelite-api/src/main/java/net/runelite/api/ParamID.java +++ b/runelite-api/src/main/java/net/runelite/api/ParamID.java @@ -29,4 +29,20 @@ package net.runelite.api; */ public class ParamID { + /** + * @see SettingID + */ + public static final int SETTING_ID = 1077; + // defaults to 5 + // 1 is continuous + public static final int SETTING_SLIDER_STEPS = 1101; + public static final int SETTING_CUSTOM_TRANSMIT = 1085; + // defaults to true + // track is foreground + public static final int SETTING_FOREGROUND_CLICKZONE = 1105; + public static final int SETTING_SLIDER_CUSTOM_ONOP = 1106; + public static final int SETTING_SLIDER_CUSTOM_SETPOS = 1107; + public static final int SETTING_SLIDER_IS_DRAGGABLE = 1108; + public static final int SETTING_SLIDER_DEADZONE = 1109; + public static final int SETTING_SLIDER_DEADTIME = 1110; } diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 7679476c49..b451aeb6cb 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -303,4 +303,21 @@ public final class ScriptID */ @ScriptArguments(integer = 18) public static final int BANKMAIN_SEARCH_TOGGLE = 281; -} + + /** + * Chooses the click handler for a {@link ParamID#SETTING_SLIDER_CUSTOM_ONOP} = 1 settings slider + * + * The active widget is set to the track created by {@link ParamID#SETTING_FOREGROUND_CLICKZONE} + *

    + *
  • int {@link ParamID#SETTING_ID}
  • + *
  • int (WidgetID) Slider handle ID
  • + *
  • int (widget index) Slider handle index
  • + *
  • int track width
  • + *
  • int y offset
  • + *
  • int x offset
  • + *
  • int (WidgetID) drag parent
  • + *
+ */ + @ScriptArguments(integer = 6) + public static final int SETTINGS_SLIDER_CHOOSE_ONOP = 3885; +} \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/SettingID.java b/runelite-api/src/main/java/net/runelite/api/SettingID.java new file mode 100644 index 0000000000..008b3259b4 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/SettingID.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Abex + * 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.api; + +/** + * @see ParamID#SETTING_ID + */ +public class SettingID +{ + public static final int MUSIC_VOLUME = 30; + public static final int EFFECT_VOLUME = 31; + public static final int AREA_VOLUME = 32; +} diff --git a/runelite-api/src/main/java/net/runelite/api/SpriteID.java b/runelite-api/src/main/java/net/runelite/api/SpriteID.java index ec1d72deff..d5bb718245 100644 --- a/runelite-api/src/main/java/net/runelite/api/SpriteID.java +++ b/runelite-api/src/main/java/net/runelite/api/SpriteID.java @@ -1591,4 +1591,8 @@ public final class SpriteID public static final int FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT = 2831; public static final int FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL = 2832; public static final int FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT = 2833; + + public static final int SETTINGS_SLIDER_HANDLE_BLUE = 2858; + public static final int SETTINGS_SLIDER_HANDLE_RED = 2859; + public static final int SETTINGS_SLIDER_HANDLE_GREEN = 2860; } diff --git a/runelite-api/src/main/java/net/runelite/api/StructID.java b/runelite-api/src/main/java/net/runelite/api/StructID.java index dd3c148cd3..e1dab81026 100644 --- a/runelite-api/src/main/java/net/runelite/api/StructID.java +++ b/runelite-api/src/main/java/net/runelite/api/StructID.java @@ -31,4 +31,7 @@ package net.runelite.api; */ public class StructID { + public static final int SETTINGS_MUSIC_VOLUME = 2753; + public static final int SETTINGS_EFFECT_VOLUME = 2754; + public static final int SETTINGS_AREA_VOLUME = 2755; } diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index b96a5994df..79d38b7e78 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -572,6 +572,13 @@ public enum Varbits LEAGUE_RELIC_5(10053), LEAGUE_RELIC_6(11696), + /** + * Muted volume restore values + */ + MUTED_MUSIC_VOLUME(9666), + MUTED_SOUND_EFFECT_VOLUME(9674), + MUTED_AREA_EFFECT_VOLUME(9675), + /** * Whether the Special Attack orb is disabled due to being in a PvP area * diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 7437371b70..5374988635 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -610,6 +610,7 @@ public class WidgetID static final int ROLE_SPRITE = 11; static final int ROLE = 12; } + static class HLR { static final int TEAMMATE1 = 18; @@ -617,6 +618,7 @@ public class WidgetID static final int TEAMMATE3 = 26; static final int TEAMMATE4 = 30; } + static final int CORRECT_STYLE = 3; static final int CURRENT_WAVE_WIDGET = 4; static final int CURRENT_WAVE = 5; @@ -839,6 +841,7 @@ public class WidgetID static final int MEMBERS_CONTAINER = 7; static final int MINIQUEST_CONTAINER = 8; } + static class Music { static final int CONTAINER = 0; @@ -884,6 +887,14 @@ public class WidgetID static class SettingsSide { static final int CAMERA_ZOOM_SLIDER_HANDLE = 55; + static final int MUSIC_SLIDER = 10; + static final int SOUND_EFFECT_SLIDER = 14; + static final int AREA_SOUND_SLIDER = 18; + } + + static class Settings + { + static final int INIT = 1; } static class AchievementDiary diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 1aa7b4d15f..70c8595b2b 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -533,6 +533,11 @@ public enum WidgetInfo SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER), SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_HANDLE), + SETTINGS_SIDE_MUSIC_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.MUSIC_SLIDER), + SETTINGS_SIDE_SOUND_EFFECT_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.SOUND_EFFECT_SLIDER), + SETTINGS_SIDE_AREA_SOUND_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.AREA_SOUND_SLIDER), + + SETTINGS_INIT(WidgetID.SETTINGS_GROUP_ID, WidgetID.Settings.INIT), ACHIEVEMENT_DIARY_CONTAINER(WidgetID.ACHIEVEMENT_DIARY_GROUP_ID, WidgetID.AchievementDiary.CONTAINER), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java index 594a1c7380..1458855db8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java @@ -31,6 +31,8 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("music") public interface MusicConfig extends Config { + String GRANULAR_SLIDERS = "granularSliders"; + @ConfigItem( keyName = "muteOwnAreaSounds", name = "Mute player area sounds", @@ -86,6 +88,17 @@ public interface MusicConfig extends Config return false; } + @ConfigItem( + keyName = GRANULAR_SLIDERS, + name = "Granular volume sliders", + description = "Make the volume sliders allow better control of volume", + position = 5 + ) + default boolean granularSliders() + { + return true; + } + @ConfigItem( keyName = "musicVolume", name = "", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index ab6757e11a..ca140e2bd4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -27,28 +27,46 @@ package net.runelite.client.plugins.music; import com.google.common.collect.ImmutableSet; +import com.google.common.primitives.Ints; import com.google.inject.Provides; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Set; +import java.util.function.Consumer; +import java.util.function.IntConsumer; +import java.util.function.IntSupplier; import java.util.stream.Collectors; import javax.inject.Inject; import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.NPC; +import net.runelite.api.ParamID; import net.runelite.api.Player; +import net.runelite.api.ScriptEvent; import net.runelite.api.ScriptID; +import net.runelite.api.SettingID; import net.runelite.api.SoundEffectID; import net.runelite.api.SpriteID; +import net.runelite.api.StructComposition; +import net.runelite.api.StructID; import net.runelite.api.VarClientInt; +import net.runelite.api.VarPlayer; +import net.runelite.api.Varbits; import net.runelite.api.events.AreaSoundEffectPlayed; +import net.runelite.api.events.BeforeRender; import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.PostStructComposition; +import net.runelite.api.events.ScriptPreFired; import net.runelite.api.events.SoundEffectPlayed; import net.runelite.api.events.VarClientIntChanged; +import net.runelite.api.events.VolumeChanged; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; @@ -59,11 +77,15 @@ import net.runelite.api.widgets.WidgetType; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigChanged; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxTextInput; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.tooltip.Tooltip; +import net.runelite.client.ui.overlay.tooltip.TooltipManager; +@Slf4j @PluginDescriptor( name = "Music", description = "Adds search and filter for the music list, and additional volume control", @@ -71,6 +93,8 @@ import net.runelite.client.plugins.PluginDescriptor; ) public class MusicPlugin extends Plugin { + private static final int SLIDER_HANDLE_SIZE = 16; + private static final Set SOURCELESS_PLAYER_SOUNDS = ImmutableSet.of( SoundEffectID.TELEPORT_VWOOP ); @@ -117,6 +141,14 @@ public class MusicPlugin extends Plugin @Inject private ChatboxPanelManager chatboxPanelManager; + @Inject + private TooltipManager tooltipManager; + + private Channel musicChannel; + private Channel effectChannel; + private Channel areaChannel; + private Channel[] channels; + private ChatboxTextInput searchInput; private Widget musicSearchButton; @@ -126,12 +158,36 @@ public class MusicPlugin extends Plugin private MusicState currentMusicFilter = MusicState.ALL; + private Tooltip sliderTooltip; + private boolean shuttingDown = false; + @Override protected void startUp() { clientThread.invoke(() -> { + this.shuttingDown = false; + + musicChannel = new Channel("Music", + VarPlayer.MUSIC_VOLUME, Varbits.MUTED_MUSIC_VOLUME, + musicConfig::getMusicVolume, musicConfig::setMusicVolume, + client::setMusicVolume, 255, + WidgetInfo.SETTINGS_SIDE_MUSIC_SLIDER); + effectChannel = new Channel("Sound Effects", + VarPlayer.SOUND_EFFECT_VOLUME, Varbits.MUTED_SOUND_EFFECT_VOLUME, + musicConfig::getSoundEffectVolume, musicConfig::setSoundEffectVolume, + client::setSoundEffectVolume, 127, + WidgetInfo.SETTINGS_SIDE_SOUND_EFFECT_SLIDER); + areaChannel = new Channel("Area Sounds", + VarPlayer.AREA_EFFECT_VOLUME, Varbits.MUTED_AREA_EFFECT_VOLUME, + musicConfig::getAreaSoundEffectVolume, musicConfig::setAreaSoundEffectVolume, + client::setAreaSoundEffectVolume, 127, + WidgetInfo.SETTINGS_SIDE_AREA_SOUND_SLIDER); + channels = new Channel[]{musicChannel, effectChannel, areaChannel}; + addMusicButtons(); + updateMusicOptions(); + resetSettingsWindow(); }); } @@ -145,6 +201,11 @@ public class MusicPlugin extends Plugin } tracks = null; + clientThread.invoke(() -> + { + shuttingDown = true; + teardownMusicOptions(); + }); } @Provides @@ -175,6 +236,12 @@ public class MusicPlugin extends Plugin currentMusicFilter = MusicState.ALL; addMusicButtons(); } + + if ((widgetLoaded.getGroupId() == WidgetID.SETTINGS_GROUP_ID || widgetLoaded.getGroupId() == WidgetID.SETTINGS_SIDE_GROUP_ID) + && musicConfig.granularSliders()) + { + updateMusicOptions(); + } } private void addMusicButtons() @@ -225,6 +292,42 @@ public class MusicPlugin extends Plugin } } + @Subscribe + public void onVolumeChanged(VolumeChanged volumeChanged) + { + if (musicConfig.granularSliders()) + { + updateMusicOptions(); + } + } + + @Subscribe + public void onConfigChanged(ConfigChanged configChanged) + { + if ("music".equals(configChanged.getGroup())) + { + clientThread.invoke(() -> + { + if (MusicConfig.GRANULAR_SLIDERS.equals(configChanged.getKey())) + { + if (musicConfig.granularSliders()) + { + updateMusicOptions(); + resetSettingsWindow(); + } + else + { + teardownMusicOptions(); + } + } + else + { + updateMusicOptions(); + } + }); + } + } + private boolean isOnMusicTab() { return client.getVar(VarClientInt.INVENTORY_TAB) == 13; @@ -350,6 +453,437 @@ public class MusicPlugin extends Plugin private final int spriteID; } + @RequiredArgsConstructor + private class Slider + { + @Getter + protected final Channel channel; + + protected Widget track; + protected Widget handle; + + public void update() + { + handle.setOnDragListener((JavaScriptCallback) this::drag); + handle.setOnDragCompleteListener((JavaScriptCallback) this::drag); + handle.setHasListener(true); + + track.setOnMouseRepeatListener((JavaScriptCallback) ev -> + { + int value = channel.getValue(); + int percent = (int) Math.round((value * 100.0 / channel.getMax())); + + sliderTooltip = new Tooltip(channel.getName() + ": " + percent + "%"); + }); + track.setOnClickListener((JavaScriptCallback) this::click); + track.setHasListener(true); + } + + public void shutDown() + { + if (handle != null) + { + handle.setDragParent(null); + handle.setOnDragListener((Object[]) null); + handle.setOnDragCompleteListener((Object[]) null); + } + if (track != null) + { + track.setOnMouseRepeatListener((Object[]) null); + track.setOnClickListener((Object[]) null); + } + } + + protected void drag(ScriptEvent ev) + { + moveHandle(ev.getMouseX()); + } + + protected void click(ScriptEvent ev) + { + moveHandle(ev.getMouseX() - (SLIDER_HANDLE_SIZE / 2)); + } + + protected void moveHandle(int x) + { + int level = (x * channel.max) / getWidth(); + level = Ints.constrainToRange(level, 0, channel.max); + channel.setLevel(level); + } + + protected int getWidth() + { + return track.getWidth() - SLIDER_HANDLE_SIZE; + } + } + + private class SettingsSideSlider extends Slider + { + private final WidgetInfo root; + private Widget icon; + + SettingsSideSlider(Channel channel, WidgetInfo root) + { + super(channel); + this.root = root; + } + + @Override + public void update() + { + Widget root = client.getWidget(this.root); + if (root == null) + { + return; + } + + Object[] onLoad = root.getOnLoadListener(); + if (onLoad == null || onLoad.length != 5) + { + return; + } + + this.icon = client.getWidget((Integer) onLoad[1]); + this.track = client.getWidget((Integer) onLoad[2]); + this.handle = client.getWidget((Integer) onLoad[3]); + if (this.track == null || this.handle == null) + { + return; + } + + for (Widget w : track.getChildren()) + { + if (w != null) + { + w.setAction(0, null); + } + } + + handle.setOnVarTransmitListener((Object[]) null); + handle.setDragParent(track); + handle.setSpriteId(SpriteID.SETTINGS_SLIDER_HANDLE_GREEN); + super.update(); + + int val = channel.getValue(); + handle.setOriginalX((val * getWidth()) / channel.getMax()); + handle.revalidate(); + + // emulate [proc,settings_update_icon] + boolean unmuted = val != 0; + icon.getChild(1).setHidden(unmuted); + icon.setAction(0, unmuted ? "Unmute" : "Mute"); + // Set name + no tooltip; we have our own for ops + icon.setName(channel.getName()); + icon.setOnMouseRepeatListener((Object[]) null); + icon.setOnOpListener((JavaScriptCallback) ev -> channel.toggleMute()); + } + + @Override + public void shutDown() + { + super.shutDown(); + handle.setSpriteId(SpriteID.SETTINGS_SLIDER_HANDLE_BLUE); + + this.icon.setOnOpListener((Object[]) null); + + Widget root = client.getWidget(this.root); + if (root != null) + { + client.createScriptEvent(root.getOnLoadListener()) + .setSource(root) + .run(); + } + + this.handle = this.track = this.icon = null; + } + } + + private class SettingsSlider extends Slider + { + private final int offsetX; + private final int offsetY; + private final int width; + private final Widget realTrack; + + SettingsSlider(Channel channel, Widget handle, Widget track, int width, int offsetY, int offsetX, Widget realTrack) + { + super(channel); + this.handle = handle; + this.track = track; + this.width = width; + this.offsetX = offsetX; + this.offsetY = offsetY; + this.realTrack = realTrack; + } + + @Override + public void update() + { + super.update(); + + int val = channel.getValue(); + handle.setOriginalX(offsetX + (val * getWidth()) / channel.getMax()); + handle.setOriginalY(offsetY); + handle.revalidate(); + } + + @Override + protected int getWidth() + { + return width - SLIDER_HANDLE_SIZE; + } + + @Override + protected void click(ScriptEvent ev) + { + super.click(ev); + realTrack.setOriginalX(offsetX); + realTrack.setOriginalY(offsetY); + realTrack.setOriginalWidth(this.width); + realTrack.setOriginalHeight(SLIDER_HANDLE_SIZE); + realTrack.revalidate(); + } + + @Override + @SuppressWarnings("PMD.UselessOverridingMethod") + public void shutDown() + { + // calling settings_init will do teardown for us + super.shutDown(); + } + } + + @Subscribe + private void onPostStructComposition(PostStructComposition ev) + { + if (shuttingDown) + { + return; + } + + StructComposition sc = ev.getStructComposition(); + switch (sc.getId()) + { + case StructID.SETTINGS_MUSIC_VOLUME: + case StructID.SETTINGS_EFFECT_VOLUME: + case StructID.SETTINGS_AREA_VOLUME: + if (!musicConfig.granularSliders()) + { + return; + } + + sc.setValue(ParamID.SETTING_SLIDER_STEPS, 1); + sc.setValue(ParamID.SETTING_CUSTOM_TRANSMIT, 0); + sc.setValue(ParamID.SETTING_FOREGROUND_CLICKZONE, 0); + sc.setValue(ParamID.SETTING_SLIDER_CUSTOM_ONOP, 1); + sc.setValue(ParamID.SETTING_SLIDER_CUSTOM_SETPOS, 1); + sc.setValue(ParamID.SETTING_SLIDER_IS_DRAGGABLE, 1); + sc.setValue(ParamID.SETTING_SLIDER_DEADZONE, 0); + sc.setValue(ParamID.SETTING_SLIDER_DEADZONE, 0); + break; + } + } + + @Subscribe + private void onScriptPreFired(ScriptPreFired ev) + { + if (shuttingDown) + { + return; + } + + if (ev.getScriptId() == ScriptID.SETTINGS_SLIDER_CHOOSE_ONOP) + { + if (!musicConfig.granularSliders()) + { + return; + } + + int arg = client.getIntStackSize() - 7; + int[] is = client.getIntStack(); + Channel channel; + switch (is[arg]) + { + case SettingID.MUSIC_VOLUME: + channel = musicChannel; + break; + case SettingID.EFFECT_VOLUME: + channel = effectChannel; + break; + case SettingID.AREA_VOLUME: + channel = areaChannel; + break; + default: + return; + } + + Widget track = client.getScriptActiveWidget(); + Widget handle = client.getWidget(is[arg + 1]) + .getChild(is[arg + 2]); + Widget realTrack = client.getWidget(is[arg + 6]); + SettingsSlider s = new SettingsSlider(channel, handle, track, is[arg + 3], is[arg + 4], is[arg + 5], realTrack); + s.update(); + s.getChannel().setWindowSlider(s); + } + } + + private class Channel + { + @Getter + private final String name; + private final VarPlayer var; + private final Varbits mutedVar; + private final IntSupplier getter; + private final Consumer setter; + private final IntConsumer volumeChanger; + + @Getter + private final int max; + + private final Slider sideSlider; + + @Setter + private Slider windowSlider; + + Channel(String name, + VarPlayer var, Varbits mutedVar, + IntSupplier getter, Consumer setter, + IntConsumer volumeChanger, int max, + WidgetInfo sideRoot) + { + this.name = name; + this.var = var; + this.mutedVar = mutedVar; + this.getter = getter; + this.setter = setter; + this.volumeChanger = volumeChanger; + this.max = max; + this.sideSlider = new SettingsSideSlider(this, sideRoot); + } + + private int getValueRaw() + { + int value = getter.getAsInt(); + if (value == 0) + { + // Use the vanilla value + + // the varps are known by the engine and it requires they are stored so + // 0 = max and 4 = muted + int raw = 4 - client.getVar(var); + if (raw == 0) + { + raw = -(4 - client.getVar(mutedVar)); + } + value = ((raw * max) / 4); + + // readd our 1 offset for unknown's place + value += value < 0 ? -1 : 1; + } + + return value; + } + + private int getValue() + { + int value = getValueRaw(); + + // muted with saved restore point + if (value < 0) + { + return 0; + } + + // 0 is used for unknown, so config values are 1 away from zero + return value - 1; + } + + public void toggleMute() + { + int val = -getValueRaw(); + if (val == -1) + { + // muted without a reset value + val = max / 2; + } + setter.accept(val); + } + + public void setLevel(int level) + { + setter.accept(level + 1); + update(); + } + + public void update() + { + volumeChanger.accept(getValue()); + sideSlider.update(); + if (windowSlider != null) + { + windowSlider.update(); + } + } + + public void shutDown() + { + sideSlider.shutDown(); + if (windowSlider != null) + { + windowSlider.shutDown(); + } + + int raw = 4 - client.getVar(var); + int value = ((raw * max) / 4); + volumeChanger.accept(value); + } + } + + private void updateMusicOptions() + { + for (Channel channel : channels) + { + channel.update(); + } + } + + private void teardownMusicOptions() + { + // the side panel uses this too, so it has to run before they get shut down + client.getStructCompositionCache().reset(); + + for (Channel channel : channels) + { + channel.shutDown(); + } + + resetSettingsWindow(); + } + + private void resetSettingsWindow() + { + client.getStructCompositionCache().reset(); + + Widget init = client.getWidget(WidgetInfo.SETTINGS_INIT); + if (init != null) + { + // [clientscript, settings_init] + client.createScriptEvent(init.getOnLoadListener()) + .setSource(init) + .run(); + } + } + + @Subscribe + private void onBeforeRender(BeforeRender ev) + { + if (sliderTooltip != null) + { + tooltipManager.add(sliderTooltip); + sliderTooltip = null; + } + } + @Subscribe public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) { From f67eed0f96720552cc9f9d90758ce499531b5500 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 7 Dec 2020 23:33:18 -0500 Subject: [PATCH 061/173] chatcommands: always apply pb from raids This logic was from prior to cox having a pb message, and so it had to compare the known pb with the current raid duration. Now that all raids have a pb message, it is no longer necessary to do this. This fixes pb times syncing up in the main game correctly that were overwritten by leagues. --- .../chatcommands/ChatCommandsPlugin.java | 8 +--- .../chatcommands/ChatCommandsPluginTest.java | 39 +------------------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 9f24c06faa..4259d0ee75 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -303,13 +303,7 @@ public class ChatCommandsPlugin extends Plugin setKc(boss, kc); if (lastPb > -1) { - // lastPb contains the last raid duration and not the personal best, because the raid - // complete message does not include the pb. We have to check if it is a new pb: - int currentPb = getPb(boss); - if (currentPb <= 0 || lastPb < currentPb) - { - setPb(boss, lastPb); - } + setPb(boss, lastPb); lastPb = -1; } lastBossKill = boss; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java index 72a9855bd7..9df5ff5891 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java @@ -59,14 +59,11 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyString; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @@ -166,7 +163,7 @@ public class ChatCommandsPluginTest } @Test - public void testTheatreOfBloodUnknownPB() + public void testTheatreOfBloodNoPb() { ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Wave 'The Final Challenge' complete! Duration: 5:04
Theatre of Blood wave completion time: 38:17
Personal best: 37:04", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -178,21 +175,6 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("personalbest", "theatre of blood", 37 * 60 + 4); } - @Test - public void testTheatreOfBloodNoPB() - { - when(configManager.getRSProfileConfiguration("personalbest", "theatre of blood", int.class)).thenReturn(37 * 60 + 4); // 37:04 - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Wave 'The Final Challenge' complete! Duration: 5:04
Theatre of Blood wave completion time: 38:17
Personal best: 37:10", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setRSProfileConfiguration("killcount", "theatre of blood", 73); - verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("theatre of blood"), anyInt()); - } - @Test public void testWintertodt() { @@ -428,10 +410,8 @@ public class ChatCommandsPluginTest } @Test - public void testCoXKillUnknownPb() + public void testCoXKillNoPb() { - when(configManager.getRSProfileConfiguration("personalbest", "chambers of xeric", int.class)).thenReturn(25 * 60 + 14); - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 11-15 players Duration: 23:25 Personal best: 20:19", null, 0); chatCommandsPlugin.onChatMessage(chatMessage); @@ -442,21 +422,6 @@ public class ChatCommandsPluginTest verify(configManager).setRSProfileConfiguration("personalbest", "chambers of xeric", 20 * 60 + 19); } - @Test - public void testCoXKillNoPb() - { - when(configManager.getRSProfileConfiguration(anyString(), anyString(), any(Class.class))).thenReturn(2224); - - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete!
Team size: 3 players Duration: 37:10 (new personal best)", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setRSProfileConfiguration("killcount", "chambers of xeric", 52); - verify(configManager, never()).setRSProfileConfiguration(eq("personalbest"), eq("chambers of xeric"), anyInt()); - } - @Test public void testAdventureLogCountersPage() { From 5c75762f83c66d4d84b325d635923a5bb81c7d3c Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 7 Dec 2020 19:32:51 -0700 Subject: [PATCH 062/173] camera: add slider tooltip to main settings window this replaces the overlay with onMouseRepeatListeners --- .../main/java/net/runelite/api/SettingID.java | 2 + .../net/runelite/api/widgets/WidgetID.java | 2 +- .../net/runelite/api/widgets/WidgetInfo.java | 2 +- .../client/plugins/camera/CameraOverlay.java | 74 -------------- .../client/plugins/camera/CameraPlugin.java | 96 +++++++++++++++++-- 5 files changed, 94 insertions(+), 82 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java diff --git a/runelite-api/src/main/java/net/runelite/api/SettingID.java b/runelite-api/src/main/java/net/runelite/api/SettingID.java index 008b3259b4..2d471d16f2 100644 --- a/runelite-api/src/main/java/net/runelite/api/SettingID.java +++ b/runelite-api/src/main/java/net/runelite/api/SettingID.java @@ -29,6 +29,8 @@ package net.runelite.api; */ public class SettingID { + public static final int CAMERA_ZOOM = 14; + public static final int MUSIC_VOLUME = 30; public static final int EFFECT_VOLUME = 31; public static final int AREA_VOLUME = 32; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 5374988635..00fe32bef1 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -886,7 +886,7 @@ public class WidgetID static class SettingsSide { - static final int CAMERA_ZOOM_SLIDER_HANDLE = 55; + static final int CAMERA_ZOOM_SLIDER_TRACK = 54; static final int MUSIC_SLIDER = 10; static final int SOUND_EFFECT_SLIDER = 14; static final int AREA_SOUND_SLIDER = 18; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 70c8595b2b..f07b5cb523 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -532,7 +532,7 @@ public enum WidgetInfo SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT), SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER), - SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_HANDLE), + SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_TRACK), SETTINGS_SIDE_MUSIC_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.MUSIC_SLIDER), SETTINGS_SIDE_SOUND_EFFECT_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.SOUND_EFFECT_SLIDER), SETTINGS_SIDE_AREA_SOUND_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.AREA_SOUND_SLIDER), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java deleted file mode 100644 index 1616cdf1e5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraOverlay.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2020, Sean Dewar - * 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.camera; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.VarClientInt; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -class CameraOverlay extends Overlay -{ - private final CameraConfig config; - private final Client client; - private final TooltipManager tooltipManager; - - @Inject - private CameraOverlay(final CameraConfig config, final Client client, final TooltipManager tooltipManager) - { - this.config = config; - this.client = client; - this.tooltipManager = tooltipManager; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(final Graphics2D graphics) - { - final Widget slider = client.getWidget(WidgetInfo.SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_HANDLE); - final Point mousePos = client.getMouseCanvasPosition(); - - if (slider == null || slider.isHidden() || !slider.getBounds().contains(mousePos.getX(), mousePos.getY())) - { - return null; - } - - final int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT); - final int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT; - - tooltipManager.add(new Tooltip("Camera Zoom: " + value + " / " + max)); - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java index 945f7434f5..3c2076a1aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java @@ -37,11 +37,20 @@ import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; import net.runelite.api.ScriptID; +import net.runelite.api.SettingID; +import net.runelite.api.VarClientInt; import net.runelite.api.VarPlayer; +import net.runelite.api.events.BeforeRender; import net.runelite.api.events.ClientTick; import net.runelite.api.events.FocusChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPreFired; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.JavaScriptCallback; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -52,7 +61,8 @@ import net.runelite.client.input.MouseListener; import net.runelite.client.input.MouseManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ui.overlay.tooltip.Tooltip; +import net.runelite.client.ui.overlay.tooltip.TooltipManager; @PluginDescriptor( name = "Camera", @@ -96,10 +106,9 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener private MouseManager mouseManager; @Inject - private OverlayManager overlayManager; + private TooltipManager tooltipManager; - @Inject - private CameraOverlay cameraOverlay; + private Tooltip sliderTooltip; @Provides CameraConfig getConfig(ConfigManager configManager) @@ -116,19 +125,50 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener copyConfigs(); keyManager.registerKeyListener(this); mouseManager.registerMouseListener(this); - overlayManager.add(cameraOverlay); + clientThread.invoke(() -> + { + Widget sideSlider = client.getWidget(WidgetInfo.SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK); + if (sideSlider != null) + { + addZoomTooltip(sideSlider); + } + + Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT); + if (settingsInit != null) + { + client.createScriptEvent(settingsInit.getOnLoadListener()) + .setSource(settingsInit) + .run(); + } + }); } @Override protected void shutDown() { - overlayManager.remove(cameraOverlay); client.setCameraPitchRelaxerEnabled(false); client.setInvertYaw(false); client.setInvertPitch(false); keyManager.unregisterKeyListener(this); mouseManager.unregisterMouseListener(this); controlDown = false; + + clientThread.invoke(() -> + { + Widget sideSlider = client.getWidget(WidgetInfo.SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK); + if (sideSlider != null) + { + sideSlider.setOnMouseRepeatListener((Object[]) null); + } + + Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT); + if (settingsInit != null) + { + client.createScriptEvent(settingsInit.getOnLoadListener()) + .setSource(settingsInit) + .run(); + } + }); } void copyConfigs() @@ -318,6 +358,50 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener menuHasEntries = hasMenuEntries(client.getMenuEntries()); } + @Subscribe + private void onScriptPreFired(ScriptPreFired ev) + { + if (ev.getScriptId() == ScriptID.SETTINGS_SLIDER_CHOOSE_ONOP) + { + int arg = client.getIntStackSize() - 7; + int[] is = client.getIntStack(); + + if (is[arg] == SettingID.CAMERA_ZOOM) + { + addZoomTooltip(client.getScriptActiveWidget()); + } + } + } + + @Subscribe + private void onWidgetLoaded(WidgetLoaded ev) + { + if (ev.getGroupId() == WidgetID.SETTINGS_SIDE_GROUP_ID) + { + addZoomTooltip(client.getWidget(WidgetInfo.SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK)); + } + } + + private void addZoomTooltip(Widget w) + { + w.setOnMouseRepeatListener((JavaScriptCallback) ev -> + { + int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT); + int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT; + sliderTooltip = new Tooltip("Camera Zoom: " + value + " / " + max); + }); + } + + @Subscribe + private void onBeforeRender(BeforeRender ev) + { + if (sliderTooltip != null) + { + tooltipManager.add(sliderTooltip); + sliderTooltip = null; + } + } + /** * The event that is triggered when a mouse button is pressed * In this method the right click is changed to a middle-click to enable rotating the camera From 7bd9d7f6df57af5bfab5c102c6c753770ced2ff5 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 9 Dec 2020 11:44:13 +0000 Subject: [PATCH 063/173] Update 193 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 25f1b102b7..9ce3b39a15 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ true - 192 + 193 From 9cdcd371ed2ea8ca68c78da6b62b58f5942bc93c Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:20 -0700 Subject: [PATCH 064/173] Update Scripts to 2020-12-9 --- .../src/main/scripts/OptionsPanelZoomUpdater.hash | 2 +- .../src/main/scripts/OptionsPanelZoomUpdater.rs2asm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash index 5c600ecde2..1f6beef765 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash +++ b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.hash @@ -1 +1 @@ -8FC0BFFDA625B6C461DE5D63771FE7A48F8833F35FA8AE4C07EAA79984803C47 \ No newline at end of file +A1B6D1B291AA3594728DDEA47049E17119F5CCB6F8E757E1524FA89DE92F9A34 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm index 831a469192..32595fbc27 100644 --- a/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm +++ b/runelite-client/src/main/scripts/OptionsPanelZoomUpdater.rs2asm @@ -23,9 +23,9 @@ runelite_callback sub istore 1 - iconst 7602230 + iconst 7602235 if_getwidth - iconst 7602231 + iconst 7602236 if_getwidth sub istore 2 @@ -78,6 +78,6 @@ LABEL44: iconst 0 iconst 0 iconst 0 - iconst 7602231 + iconst 7602236 if_setposition return From 96372dbdb2841bc632ee53d174888ab4353c214e Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:21 -0700 Subject: [PATCH 065/173] Update Item IDs to 2020-12-9 --- .../main/java/net/runelite/api/ItemID.java | 91 +++++++++++++++++++ .../java/net/runelite/api/NullItemID.java | 51 +++++++++++ 2 files changed, 142 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 549bd52ea5..6301bf633d 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -11565,5 +11565,96 @@ public final class ItemID public static final int DECORATIVE_BOOTS_L = 25173; public static final int DECORATIVE_FULL_HELM_25174 = 25174; public static final int DECORATIVE_FULL_HELM_L = 25176; + public static final int SLAYER_HELMET_I_25177 = 25177; + public static final int BLACK_SLAYER_HELMET_I_25179 = 25179; + public static final int GREEN_SLAYER_HELMET_I_25181 = 25181; + public static final int RED_SLAYER_HELMET_I_25183 = 25183; + public static final int PURPLE_SLAYER_HELMET_I_25185 = 25185; + public static final int TURQUOISE_SLAYER_HELMET_I_25187 = 25187; + public static final int HYDRA_SLAYER_HELMET_I_25189 = 25189; + public static final int TWISTED_SLAYER_HELMET_I_25191 = 25191; + public static final int GRANITE_RING_I_25193 = 25193; + public static final int BLUE_CAPE_25195 = 25195; + public static final int SOUL_FRAGMENT = 25196; + public static final int SOUL_WARS_GUIDE = 25197; + public static final int BONES_25199 = 25199; + public static final int SOUL_FRAGMENT_25201 = 25201; + public static final int BANDAGES_25202 = 25202; + public static final int POTION_OF_POWER4 = 25203; + public static final int POTION_OF_POWER3 = 25204; + public static final int POTION_OF_POWER2 = 25205; + public static final int POTION_OF_POWER1 = 25206; + public static final int RED_CAPE_25207 = 25207; + public static final int BLUE_CAPE_25208 = 25208; + public static final int BARRICADE_25209 = 25209; + public static final int BARRICADE_25210 = 25210; + public static final int EXPLOSIVE_POTION_25211 = 25211; + public static final int BLUE_ICON = 25212; + public static final int BLUE_ICON_25213 = 25213; + public static final int BLUE_ICON_25214 = 25214; + public static final int BLUE_ICON_25215 = 25215; + public static final int BLUE_ICON_25216 = 25216; + public static final int BLUE_ICON_25217 = 25217; + public static final int BLUE_ICON_25218 = 25218; + public static final int BLUE_ICON_25219 = 25219; + public static final int BLUE_ICON_25220 = 25220; + public static final int BLUE_ICON_25221 = 25221; + public static final int BLUE_ICON_25222 = 25222; + public static final int BLUE_ICON_25223 = 25223; + public static final int BLUE_ICON_25224 = 25224; + public static final int BLUE_ICON_25225 = 25225; + public static final int BLUE_ICON_25226 = 25226; + public static final int BLUE_ICON_25227 = 25227; + public static final int RED_ICON = 25228; + public static final int RED_ICON_25229 = 25229; + public static final int RED_ICON_25230 = 25230; + public static final int RED_ICON_25231 = 25231; + public static final int RED_ICON_25232 = 25232; + public static final int RED_ICON_25233 = 25233; + public static final int RED_ICON_25234 = 25234; + public static final int RED_ICON_25235 = 25235; + public static final int RED_ICON_25236 = 25236; + public static final int RED_ICON_25237 = 25237; + public static final int RED_ICON_25238 = 25238; + public static final int RED_ICON_25239 = 25239; + public static final int RED_ICON_25240 = 25240; + public static final int RED_ICON_25241 = 25241; + public static final int RED_ICON_25242 = 25242; + public static final int RED_ICON_25243 = 25243; + public static final int OLD_KEY_25244 = 25244; + public static final int RING_OF_SUFFERING_I_25246 = 25246; + public static final int RING_OF_SUFFERING_RI_25248 = 25248; + public static final int SALVE_AMULETI_25250 = 25250; + public static final int RING_OF_THE_GODS_I_25252 = 25252; + public static final int TYRANNICAL_RING_I_25254 = 25254; + public static final int TREASONOUS_RING_I_25256 = 25256; + public static final int SEERS_RING_I_25258 = 25258; + public static final int ARCHERS_RING_I_25260 = 25260; + public static final int WARRIOR_RING_I_25262 = 25262; + public static final int BERSERKER_RING_I_25264 = 25264; + public static final int BLACK_MASK_10_I_25266 = 25266; + public static final int BLACK_MASK_9_I_25267 = 25267; + public static final int BLACK_MASK_8_I_25268 = 25268; + public static final int BLACK_MASK_7_I_25269 = 25269; + public static final int BLACK_MASK_6_I_25270 = 25270; + public static final int BLACK_MASK_5_I_25271 = 25271; + public static final int BLACK_MASK_4_I_25272 = 25272; + public static final int BLACK_MASK_3_I_25273 = 25273; + public static final int BLACK_MASK_2_I_25274 = 25274; + public static final int BLACK_MASK_1_I_25275 = 25275; + public static final int BLACK_MASK_I_25276 = 25276; + public static final int SALVE_AMULETEI_25278 = 25278; + public static final int PURE_ESSENCE_PACK = 25280; + public static final int SLED_25282 = 25282; + public static final int RED_FIREFLIES = 25283; + public static final int GREEN_FIREFLIES = 25284; + public static final int STICK_25285 = 25285; + public static final int MOULDY_SAWDUST = 25286; + public static final int ROTTEN_MEAT = 25287; + public static final int STALE_BREAD = 25288; + public static final int GOBLIN_STEW = 25289; + public static final int GOBLIN_GIFTS = 25290; + public static final int GIANT_BOULDER = 25314; + public static final int GOBLIN_DECORATIONS = 25316; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 0f443dfe91..bccd666609 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -13401,5 +13401,56 @@ public final class NullItemID public static final int NULL_25170 = 25170; public static final int NULL_25172 = 25172; public static final int NULL_25175 = 25175; + public static final int NULL_25178 = 25178; + public static final int NULL_25180 = 25180; + public static final int NULL_25182 = 25182; + public static final int NULL_25184 = 25184; + public static final int NULL_25186 = 25186; + public static final int NULL_25188 = 25188; + public static final int NULL_25190 = 25190; + public static final int NULL_25192 = 25192; + public static final int NULL_25194 = 25194; + public static final int NULL_25198 = 25198; + public static final int NULL_25200 = 25200; + public static final int NULL_25245 = 25245; + public static final int NULL_25247 = 25247; + public static final int NULL_25249 = 25249; + public static final int NULL_25251 = 25251; + public static final int NULL_25253 = 25253; + public static final int NULL_25255 = 25255; + public static final int NULL_25257 = 25257; + public static final int NULL_25259 = 25259; + public static final int NULL_25261 = 25261; + public static final int NULL_25263 = 25263; + public static final int NULL_25265 = 25265; + public static final int NULL_25277 = 25277; + public static final int NULL_25279 = 25279; + public static final int NULL_25281 = 25281; + public static final int NULL_25291 = 25291; + public static final int NULL_25292 = 25292; + public static final int NULL_25293 = 25293; + public static final int NULL_25294 = 25294; + public static final int NULL_25295 = 25295; + public static final int NULL_25296 = 25296; + public static final int NULL_25297 = 25297; + public static final int NULL_25298 = 25298; + public static final int NULL_25299 = 25299; + public static final int NULL_25300 = 25300; + public static final int NULL_25301 = 25301; + public static final int NULL_25302 = 25302; + public static final int NULL_25303 = 25303; + public static final int NULL_25304 = 25304; + public static final int NULL_25305 = 25305; + public static final int NULL_25306 = 25306; + public static final int NULL_25307 = 25307; + public static final int NULL_25308 = 25308; + public static final int NULL_25309 = 25309; + public static final int NULL_25310 = 25310; + public static final int NULL_25311 = 25311; + public static final int NULL_25312 = 25312; + public static final int NULL_25313 = 25313; + public static final int NULL_25315 = 25315; + public static final int NULL_25317 = 25317; + public static final int NULL_25318 = 25318; /* This file is automatically generated. Do not edit. */ } From 8822294c421288b86267a39669c442ecc8428df2 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:21 -0700 Subject: [PATCH 066/173] Update Script arguments to 2020-12-9 --- runelite-api/src/main/java/net/runelite/api/ScriptID.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index b451aeb6cb..e5d086ced0 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -318,6 +318,6 @@ public final class ScriptID *
  • int (WidgetID) drag parent
  • * */ - @ScriptArguments(integer = 6) + @ScriptArguments(integer = 7) public static final int SETTINGS_SLIDER_CHOOSE_ONOP = 3885; } \ No newline at end of file From 7dc41e8dfbfed9821065ec3c3f76489979013aca Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:21 -0700 Subject: [PATCH 067/173] Update Item variations to 2020-12-9 --- .../src/main/resources/item_variations.json | 135 +++++++++++++++--- 1 file changed, 119 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 9996438144..80dd7dd319 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -547,7 +547,8 @@ 526, 2530, 3187, - 24655 + 24655, + 25199 ], "monks robe": [ 542, @@ -1652,6 +1653,10 @@ 1005, 7957 ], + "red cape": [ + 1007, + 25207 + ], "blue skirt": [ 1011, 7386, @@ -1662,6 +1667,11 @@ 12445, 12447 ], + "blue cape": [ + 1021, + 25195, + 25208 + ], "blue partyhat": [ 1042, 2422 @@ -3353,7 +3363,17 @@ ], "explosive potion": [ 4045, - 23818 + 23818, + 25211 + ], + "bandages": [ + 4049, + 25202 + ], + "barricade": [ + 4053, + 25209, + 25210 ], "decorative sword": [ 4068, @@ -3420,11 +3440,14 @@ 4081, 10588, 12017, - 12018 + 12018, + 25250, + 25278 ], "sled": [ 4083, - 4084 + 4084, + 25282 ], "dragon platelegs": [ 4087, @@ -3499,7 +3522,8 @@ ], "stick": [ 4179, - 9702 + 9702, + 25285 ], "extended brush": [ 4191, @@ -4795,20 +4819,24 @@ "seers ring": [ 6731, 11770, - 23624 + 23624, + 25258 ], "archers ring": [ 6733, - 11771 + 11771, + 25260 ], "warrior ring": [ 6735, - 11772 + 11772, + 25262 ], "berserker ring": [ 6737, 11773, - 23595 + 23595, + 25264 ], "darklight": [ 6746, @@ -6119,7 +6147,18 @@ 11781, 11782, 11783, - 11784 + 11784, + 25266, + 25267, + 25268, + 25269, + 25270, + 25271, + 25272, + 25273, + 25274, + 25275, + 25276 ], "bandana eyepatch": [ 8924, @@ -7392,7 +7431,15 @@ 23073, 23075, 24370, - 24444 + 24444, + 25177, + 25179, + 25181, + 25183, + 25185, + 25187, + 25189, + 25191 ], "slayer ring": [ 11866, @@ -7477,15 +7524,18 @@ ], "ring of the gods": [ 12601, - 13202 + 13202, + 25252 ], "tyrannical ring": [ 12603, - 12691 + 12691, + 25254 ], "treasonous ring": [ 12605, - 12692 + 12692, + 25256 ], "bandos page": [ 12613, @@ -8220,7 +8270,9 @@ 19550, 19710, 20655, - 20657 + 20657, + 25246, + 25248 ], "amulet of torture": [ 19553, @@ -8599,7 +8651,8 @@ ], "granite ring": [ 21739, - 21752 + 21752, + 25193 ], "imbued saradomin max cape": [ 21776, @@ -8877,6 +8930,10 @@ 22405, 22446 ], + "old key": [ + 22428, + 25244 + ], "battlemage potion": [ 22449, 22452, @@ -9496,5 +9553,51 @@ 25160, 25161, 25162 + ], + "soul fragment": [ + 25196, + 25201 + ], + "potion of power": [ + 25203, + 25204, + 25205, + 25206 + ], + "blue icon": [ + 25212, + 25213, + 25214, + 25215, + 25216, + 25217, + 25218, + 25219, + 25220, + 25221, + 25222, + 25223, + 25224, + 25225, + 25226, + 25227 + ], + "red icon": [ + 25228, + 25229, + 25230, + 25231, + 25232, + 25233, + 25234, + 25235, + 25236, + 25237, + 25238, + 25239, + 25240, + 25241, + 25242, + 25243 ] } \ No newline at end of file From b68acebb52c820a29bf3c4cfabd15baab85b7467 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:21 -0700 Subject: [PATCH 068/173] Update Object IDs to 2020-12-9 --- .../java/net/runelite/api/NullObjectID.java | 289 ++++++++++++++++++ .../main/java/net/runelite/api/ObjectID.java | 239 ++++++++++++++- .../runelite/client/plugins/poh/PohIcons.java | 2 +- 3 files changed, 518 insertions(+), 12 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index 95484a9022..c17eb35c8e 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -5407,8 +5407,16 @@ public final class NullObjectID public static final int NULL_12383 = 12383; public static final int NULL_12384 = 12384; public static final int NULL_12385 = 12385; + public static final int NULL_12392 = 12392; + public static final int NULL_12393 = 12393; + public static final int NULL_12394 = 12394; + public static final int NULL_12395 = 12395; public static final int NULL_12397 = 12397; public static final int NULL_12398 = 12398; + public static final int NULL_12403 = 12403; + public static final int NULL_12404 = 12404; + public static final int NULL_12405 = 12405; + public static final int NULL_12406 = 12406; public static final int NULL_12416 = 12416; public static final int NULL_12417 = 12417; public static final int NULL_12418 = 12418; @@ -19746,5 +19754,286 @@ public final class NullObjectID public static final int NULL_40427 = 40427; public static final int NULL_40428 = 40428; public static final int NULL_40429 = 40429; + public static final int NULL_40477 = 40477; + public static final int NULL_40478 = 40478; + public static final int NULL_40479 = 40479; + public static final int NULL_40480 = 40480; + public static final int NULL_40481 = 40481; + public static final int NULL_40482 = 40482; + public static final int NULL_40483 = 40483; + public static final int NULL_40484 = 40484; + public static final int NULL_40485 = 40485; + public static final int NULL_40486 = 40486; + public static final int NULL_40487 = 40487; + public static final int NULL_40488 = 40488; + public static final int NULL_40489 = 40489; + public static final int NULL_40490 = 40490; + public static final int NULL_40500 = 40500; + public static final int NULL_40501 = 40501; + public static final int NULL_40502 = 40502; + public static final int NULL_40503 = 40503; + public static final int NULL_40504 = 40504; + public static final int NULL_40505 = 40505; + public static final int NULL_40506 = 40506; + public static final int NULL_40507 = 40507; + public static final int NULL_40508 = 40508; + public static final int NULL_40509 = 40509; + public static final int NULL_40510 = 40510; + public static final int NULL_40511 = 40511; + public static final int NULL_40512 = 40512; + public static final int NULL_40513 = 40513; + public static final int NULL_40514 = 40514; + public static final int NULL_40515 = 40515; + public static final int NULL_40516 = 40516; + public static final int NULL_40517 = 40517; + public static final int NULL_40518 = 40518; + public static final int NULL_40519 = 40519; + public static final int NULL_40520 = 40520; + public static final int NULL_40521 = 40521; + public static final int NULL_40522 = 40522; + public static final int NULL_40523 = 40523; + public static final int NULL_40524 = 40524; + public static final int NULL_40525 = 40525; + public static final int NULL_40526 = 40526; + public static final int NULL_40527 = 40527; + public static final int NULL_40528 = 40528; + public static final int NULL_40529 = 40529; + public static final int NULL_40530 = 40530; + public static final int NULL_40531 = 40531; + public static final int NULL_40532 = 40532; + public static final int NULL_40533 = 40533; + public static final int NULL_40534 = 40534; + public static final int NULL_40535 = 40535; + public static final int NULL_40536 = 40536; + public static final int NULL_40537 = 40537; + public static final int NULL_40538 = 40538; + public static final int NULL_40539 = 40539; + public static final int NULL_40540 = 40540; + public static final int NULL_40541 = 40541; + public static final int NULL_40542 = 40542; + public static final int NULL_40543 = 40543; + public static final int NULL_40552 = 40552; + public static final int NULL_40553 = 40553; + public static final int NULL_40554 = 40554; + public static final int NULL_40555 = 40555; + public static final int NULL_40556 = 40556; + public static final int NULL_40557 = 40557; + public static final int NULL_40558 = 40558; + public static final int NULL_40559 = 40559; + public static final int NULL_40560 = 40560; + public static final int NULL_40561 = 40561; + public static final int NULL_40562 = 40562; + public static final int NULL_40563 = 40563; + public static final int NULL_40564 = 40564; + public static final int NULL_40565 = 40565; + public static final int NULL_40566 = 40566; + public static final int NULL_40567 = 40567; + public static final int NULL_40568 = 40568; + public static final int NULL_40569 = 40569; + public static final int NULL_40570 = 40570; + public static final int NULL_40571 = 40571; + public static final int NULL_40572 = 40572; + public static final int NULL_40573 = 40573; + public static final int NULL_40574 = 40574; + public static final int NULL_40575 = 40575; + public static final int NULL_40576 = 40576; + public static final int NULL_40577 = 40577; + public static final int NULL_40578 = 40578; + public static final int NULL_40579 = 40579; + public static final int NULL_40580 = 40580; + public static final int NULL_40581 = 40581; + public static final int NULL_40582 = 40582; + public static final int NULL_40583 = 40583; + public static final int NULL_40584 = 40584; + public static final int NULL_40585 = 40585; + public static final int NULL_40586 = 40586; + public static final int NULL_40587 = 40587; + public static final int NULL_40591 = 40591; + public static final int NULL_40592 = 40592; + public static final int NULL_40593 = 40593; + public static final int NULL_40594 = 40594; + public static final int NULL_40595 = 40595; + public static final int NULL_40596 = 40596; + public static final int NULL_40597 = 40597; + public static final int NULL_40598 = 40598; + public static final int NULL_40599 = 40599; + public static final int NULL_40600 = 40600; + public static final int NULL_40601 = 40601; + public static final int NULL_40602 = 40602; + public static final int NULL_40603 = 40603; + public static final int NULL_40604 = 40604; + public static final int NULL_40605 = 40605; + public static final int NULL_40606 = 40606; + public static final int NULL_40607 = 40607; + public static final int NULL_40608 = 40608; + public static final int NULL_40609 = 40609; + public static final int NULL_40610 = 40610; + public static final int NULL_40611 = 40611; + public static final int NULL_40612 = 40612; + public static final int NULL_40613 = 40613; + public static final int NULL_40614 = 40614; + public static final int NULL_40615 = 40615; + public static final int NULL_40616 = 40616; + public static final int NULL_40617 = 40617; + public static final int NULL_40618 = 40618; + public static final int NULL_40619 = 40619; + public static final int NULL_40620 = 40620; + public static final int NULL_40621 = 40621; + public static final int NULL_40622 = 40622; + public static final int NULL_40623 = 40623; + public static final int NULL_40624 = 40624; + public static final int NULL_40625 = 40625; + public static final int NULL_40626 = 40626; + public static final int NULL_40627 = 40627; + public static final int NULL_40628 = 40628; + public static final int NULL_40629 = 40629; + public static final int NULL_40630 = 40630; + public static final int NULL_40631 = 40631; + public static final int NULL_40632 = 40632; + public static final int NULL_40633 = 40633; + public static final int NULL_40634 = 40634; + public static final int NULL_40635 = 40635; + public static final int NULL_40636 = 40636; + public static final int NULL_40637 = 40637; + public static final int NULL_40638 = 40638; + public static final int NULL_40639 = 40639; + public static final int NULL_40640 = 40640; + public static final int NULL_40641 = 40641; + public static final int NULL_40642 = 40642; + public static final int NULL_40643 = 40643; + public static final int NULL_40644 = 40644; + public static final int NULL_40645 = 40645; + public static final int NULL_40646 = 40646; + public static final int NULL_40647 = 40647; + public static final int NULL_40648 = 40648; + public static final int NULL_40649 = 40649; + public static final int NULL_40650 = 40650; + public static final int NULL_40651 = 40651; + public static final int NULL_40652 = 40652; + public static final int NULL_40653 = 40653; + public static final int NULL_40654 = 40654; + public static final int NULL_40655 = 40655; + public static final int NULL_40656 = 40656; + public static final int NULL_40657 = 40657; + public static final int NULL_40658 = 40658; + public static final int NULL_40659 = 40659; + public static final int NULL_40660 = 40660; + public static final int NULL_40661 = 40661; + public static final int NULL_40662 = 40662; + public static final int NULL_40663 = 40663; + public static final int NULL_40664 = 40664; + public static final int NULL_40665 = 40665; + public static final int NULL_40666 = 40666; + public static final int NULL_40667 = 40667; + public static final int NULL_40668 = 40668; + public static final int NULL_40669 = 40669; + public static final int NULL_40670 = 40670; + public static final int NULL_40671 = 40671; + public static final int NULL_40672 = 40672; + public static final int NULL_40673 = 40673; + public static final int NULL_40674 = 40674; + public static final int NULL_40675 = 40675; + public static final int NULL_40676 = 40676; + public static final int NULL_40677 = 40677; + public static final int NULL_40678 = 40678; + public static final int NULL_40679 = 40679; + public static final int NULL_40680 = 40680; + public static final int NULL_40681 = 40681; + public static final int NULL_40682 = 40682; + public static final int NULL_40683 = 40683; + public static final int NULL_40684 = 40684; + public static final int NULL_40685 = 40685; + public static final int NULL_40686 = 40686; + public static final int NULL_40687 = 40687; + public static final int NULL_40688 = 40688; + public static final int NULL_40689 = 40689; + public static final int NULL_40690 = 40690; + public static final int NULL_40691 = 40691; + public static final int NULL_40692 = 40692; + public static final int NULL_40693 = 40693; + public static final int NULL_40694 = 40694; + public static final int NULL_40695 = 40695; + public static final int NULL_40696 = 40696; + public static final int NULL_40697 = 40697; + public static final int NULL_40698 = 40698; + public static final int NULL_40699 = 40699; + public static final int NULL_40700 = 40700; + public static final int NULL_40701 = 40701; + public static final int NULL_40702 = 40702; + public static final int NULL_40703 = 40703; + public static final int NULL_40704 = 40704; + public static final int NULL_40705 = 40705; + public static final int NULL_40706 = 40706; + public static final int NULL_40707 = 40707; + public static final int NULL_40708 = 40708; + public static final int NULL_40709 = 40709; + public static final int NULL_40710 = 40710; + public static final int NULL_40711 = 40711; + public static final int NULL_40712 = 40712; + public static final int NULL_40713 = 40713; + public static final int NULL_40714 = 40714; + public static final int NULL_40717 = 40717; + public static final int NULL_40718 = 40718; + public static final int NULL_40719 = 40719; + public static final int NULL_40720 = 40720; + public static final int NULL_40721 = 40721; + public static final int NULL_40722 = 40722; + public static final int NULL_40724 = 40724; + public static final int NULL_40726 = 40726; + public static final int NULL_40727 = 40727; + public static final int NULL_40729 = 40729; + public static final int NULL_40730 = 40730; + public static final int NULL_40740 = 40740; + public static final int NULL_40743 = 40743; + public static final int NULL_40745 = 40745; + public static final int NULL_40746 = 40746; + public static final int NULL_40747 = 40747; + public static final int NULL_40748 = 40748; + public static final int NULL_40749 = 40749; + public static final int NULL_40762 = 40762; + public static final int NULL_40763 = 40763; + public static final int NULL_40764 = 40764; + public static final int NULL_40765 = 40765; + public static final int NULL_40766 = 40766; + public static final int NULL_40767 = 40767; + public static final int NULL_40779 = 40779; + public static final int NULL_40862 = 40862; + public static final int NULL_40863 = 40863; + public static final int NULL_40864 = 40864; + public static final int NULL_40865 = 40865; + public static final int NULL_40866 = 40866; + public static final int NULL_40867 = 40867; + public static final int NULL_40868 = 40868; + public static final int NULL_40869 = 40869; + public static final int NULL_40870 = 40870; + public static final int NULL_40890 = 40890; + public static final int NULL_40895 = 40895; + public static final int NULL_40898 = 40898; + public static final int NULL_40900 = 40900; + public static final int NULL_40907 = 40907; + public static final int NULL_40908 = 40908; + public static final int NULL_40912 = 40912; + public static final int NULL_40913 = 40913; + public static final int NULL_40914 = 40914; + public static final int NULL_40915 = 40915; + public static final int NULL_40916 = 40916; + public static final int NULL_40917 = 40917; + public static final int NULL_40918 = 40918; + public static final int NULL_40919 = 40919; + public static final int NULL_40920 = 40920; + public static final int NULL_40921 = 40921; + public static final int NULL_40922 = 40922; + public static final int NULL_40923 = 40923; + public static final int NULL_40924 = 40924; + public static final int NULL_40925 = 40925; + public static final int NULL_40926 = 40926; + public static final int NULL_40927 = 40927; + public static final int NULL_40928 = 40928; + public static final int NULL_40929 = 40929; + public static final int NULL_40930 = 40930; + public static final int NULL_40931 = 40931; + public static final int NULL_40934 = 40934; + public static final int NULL_40935 = 40935; + public static final int NULL_40936 = 40936; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 1ab3210616..63f154fe47 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -6988,19 +6988,11 @@ public final class ObjectID public static final int LADDER_12389 = 12389; public static final int LADDER_12390 = 12390; public static final int LADDER_12391 = 12391; - public static final int SACKS_12392 = 12392; - public static final int SACKS_12393 = 12393; - public static final int SACK_PILE = 12394; - public static final int SACK_PILE_12395 = 12395; public static final int SACK_12396 = 12396; public static final int SACK_12399 = 12399; public static final int CAULDRON_12400 = 12400; public static final int CAULDRON_12401 = 12401; public static final int EXPLOSION = 12402; - public static final int SHELVES_12403 = 12403; - public static final int SHELVES_12404 = 12404; - public static final int CUPBOARD_12405 = 12405; - public static final int CUPBOARD_12406 = 12406; public static final int STOOL_12407 = 12407; public static final int STOOL_12408 = 12408; public static final int STOOL_12409 = 12409; @@ -9032,7 +9024,7 @@ public final class ObjectID public static final int LARGE_DOOR_15758 = 15758; public static final int DOOR_15759 = 15759; public static final int SACK_15760 = 15760; - public static final int SACK_PILE_15761 = 15761; + public static final int SACK_PILE = 15761; public static final int SACKS_15762 = 15762; public static final int BED_15767 = 15767; public static final int CRATE_15768 = 15768; @@ -15424,8 +15416,8 @@ public final class ObjectID public static final int POOL_OF_RESTORATION = 29237; public static final int POOL_OF_REVITALISATION = 29238; public static final int POOL_OF_REJUVENATION = 29239; - public static final int FANCY_REJUVENATION_POOL = 29240; - public static final int ORNATE_REJUVENATION_POOL = 29241; + public static final int FANCY_POOL_OF_REJUVENATION = 29240; + public static final int ORNATE_POOL_OF_REJUVENATION = 29241; public static final int ZEN_GARDEN = 29242; public static final int ZEN_GARDEN_29243 = 29243; public static final int ZEN_GARDEN_29244 = 29244; @@ -20673,5 +20665,230 @@ public final class ObjectID public static final int ORNATE_VAMPYRE_COMBAT_DUMMY = 40430; public static final int ORNATE_DRAGON_COMBAT_DUMMY = 40431; public static final int TABLE_40432 = 40432; + public static final int TREE_40433 = 40433; + public static final int SUPPLIES_40434 = 40434; + public static final int SOUL_OBELISK = 40435; + public static final int SOUL_OBELISK_40436 = 40436; + public static final int BLUE_BARRIER = 40437; + public static final int RED_BARRIER = 40438; + public static final int NEUTRAL_BARRIER = 40439; + public static final int PORTAL_40440 = 40440; + public static final int PORTAL_40441 = 40441; + public static final int BANDAGE_TABLE = 40442; + public static final int BARRICADE_TABLE = 40443; + public static final int BARRICADE_TABLE_40444 = 40444; + public static final int EXPLOSIVE_POTION_TABLE = 40445; + public static final int POTION_OF_POWER_TABLE = 40446; + public static final int TENT_40447 = 40447; + public static final int SCOREBOARD_40448 = 40448; + public static final int SOUL_OBELISK_40449 = 40449; + public static final int SOUL_OBELISK_40450 = 40450; + public static final int SOUL_OBELISK_40451 = 40451; + public static final int BLUE_BARRIER_40452 = 40452; + public static final int BLUE_BARRIER_40453 = 40453; + public static final int BLUE_BARRIER_40454 = 40454; + public static final int RED_BARRIER_40455 = 40455; + public static final int RED_BARRIER_40456 = 40456; + public static final int RED_BARRIER_40457 = 40457; + public static final int NEUTRAL_BARRIER_40458 = 40458; + public static final int NEUTRAL_BARRIER_40459 = 40459; + public static final int PORTAL_40460 = 40460; + public static final int PORTAL_40461 = 40461; + public static final int BANDAGE_TABLE_40462 = 40462; + public static final int BANDAGE_TABLE_40463 = 40463; + public static final int BARRICADE_TABLE_40464 = 40464; + public static final int BARRICADE_TABLE_40465 = 40465; + public static final int EXPLOSIVE_POTION_TABLE_40466 = 40466; + public static final int EXPLOSIVE_POTION_TABLE_40467 = 40467; + public static final int POTION_OF_POWER_TABLE_40468 = 40468; + public static final int POTION_OF_POWER_TABLE_40469 = 40469; + public static final int BLUE_BARRIER_40470 = 40470; + public static final int RED_BARRIER_40471 = 40471; + public static final int BALANCE_PORTAL = 40472; + public static final int BANK_CHEST_40473 = 40473; + public static final int SOUL_WARS_PORTAL = 40474; + public static final int SOUL_WARS_PORTAL_40475 = 40475; + public static final int PORTAL_40476 = 40476; + public static final int GRAVESTONE_40491 = 40491; + public static final int GRAVESTONE_40492 = 40492; + public static final int GRAVESTONE_40493 = 40493; + public static final int GRAVESTONE_40494 = 40494; + public static final int GRAVESTONE_40495 = 40495; + public static final int GRAVESTONE_40496 = 40496; + public static final int GRAVESTONE_40497 = 40497; + public static final int GRAVESTONE_40498 = 40498; + public static final int GRAVESTONE_40499 = 40499; + public static final int CRATE_40544 = 40544; + public static final int CRATE_40545 = 40545; + public static final int CRATE_40546 = 40546; + public static final int CRATE_40547 = 40547; + public static final int BARREL_40548 = 40548; + public static final int BARREL_40549 = 40549; + public static final int TORCH_40550 = 40550; + public static final int TORCH_40551 = 40551; + public static final int CRATE_40588 = 40588; + public static final int CRATE_40589 = 40589; + public static final int BARREL_40590 = 40590; + public static final int TREE_40715 = 40715; + public static final int TREE_40716 = 40716; + public static final int FENCE_40723 = 40723; + public static final int ANVIL_40725 = 40725; + public static final int FIRE_40728 = 40728; + public static final int TENT_40731 = 40731; + public static final int BROKEN_POTTERS_WHEEL = 40732; + public static final int POTTERS_WHEEL_40733 = 40733; + public static final int BROKEN_SPINNING_WHEEL_40734 = 40734; + public static final int SPINNING_WHEEL_40735 = 40735; + public static final int CAVE_40736 = 40736; + public static final int OPENING_40737 = 40737; + public static final int BONES_40738 = 40738; + public static final int CHEST_40739 = 40739; + public static final int CHEST_40741 = 40741; + public static final int LOCKED_CHEST_40742 = 40742; + public static final int BARREL_40744 = 40744; + public static final int TREE_40750 = 40750; + public static final int TREE_STUMP_40751 = 40751; + public static final int TREE_40752 = 40752; + public static final int TREE_STUMP_40753 = 40753; + public static final int MAPLE_TREE_40754 = 40754; + public static final int MAPLE_TREE_40755 = 40755; + public static final int YEW_40756 = 40756; + public static final int TREE_STUMP_40757 = 40757; + public static final int TEAK_40758 = 40758; + public static final int TREE_STUMP_40759 = 40759; + public static final int MAHOGANY_40760 = 40760; + public static final int TREE_STUMP_40761 = 40761; + public static final int DOOR_HOTSPOT_40768 = 40768; + public static final int DOOR_HOTSPOT_40769 = 40769; + public static final int WINDOW_SPACE_40770 = 40770; + public static final int CHRISTMAS_CURTAINS = 40771; + public static final int CHRISTMAS_CURTAINS_40772 = 40772; + public static final int CHRISTMAS_CURTAINS_40773 = 40773; + public static final int DECORATED_LIMESTONE_FIREPLACE = 40774; + public static final int DECORATED_LIMESTONE_FIREPLACE_40775 = 40775; + public static final int DECORATED_MARBLE_FIREPLACE = 40776; + public static final int DECORATED_MARBLE_FIREPLACE_40777 = 40777; + public static final int CHRISTMASSPIRIT_TREE = 40778; + public static final int SPIRITUAL_FAIRY_TREE_40780 = 40780; + public static final int SPIRITUAL_FAIRY_TREE_40781 = 40781; + public static final int SPIRITUAL_FAIRY_TREE_40782 = 40782; + public static final int SPIRITUAL_FAIRY_TREE_40783 = 40783; + public static final int SPIRITUAL_FAIRY_TREE_40784 = 40784; + public static final int SPIRITUAL_FAIRY_TREE_40785 = 40785; + public static final int SPIRITUAL_FAIRY_TREE_40786 = 40786; + public static final int SPIRITUAL_FAIRY_TREE_40787 = 40787; + public static final int SPIRITUAL_FAIRY_TREE_40788 = 40788; + public static final int SPIRITUAL_FAIRY_TREE_40789 = 40789; + public static final int SPIRITUAL_FAIRY_TREE_40790 = 40790; + public static final int SPIRITUAL_FAIRY_TREE_40791 = 40791; + public static final int SPIRITUAL_FAIRY_TREE_40792 = 40792; + public static final int SPIRITUAL_FAIRY_TREE_40793 = 40793; + public static final int SPIRITUAL_FAIRY_TREE_40794 = 40794; + public static final int SPIRITUAL_FAIRY_TREE_40795 = 40795; + public static final int SPIRITUAL_FAIRY_TREE_40796 = 40796; + public static final int SPIRITUAL_FAIRY_TREE_40797 = 40797; + public static final int SPIRITUAL_FAIRY_TREE_40798 = 40798; + public static final int SPIRITUAL_FAIRY_TREE_40799 = 40799; + public static final int SPIRITUAL_FAIRY_TREE_40800 = 40800; + public static final int SPIRITUAL_FAIRY_TREE_40801 = 40801; + public static final int SPIRITUAL_FAIRY_TREE_40802 = 40802; + public static final int SPIRITUAL_FAIRY_TREE_40803 = 40803; + public static final int SPIRITUAL_FAIRY_TREE_40804 = 40804; + public static final int SPIRITUAL_FAIRY_TREE_40805 = 40805; + public static final int SPIRITUAL_FAIRY_TREE_40806 = 40806; + public static final int SPIRITUAL_FAIRY_TREE_40807 = 40807; + public static final int SPIRITUAL_FAIRY_TREE_40808 = 40808; + public static final int SPIRITUAL_FAIRY_TREE_40809 = 40809; + public static final int SPIRITUAL_FAIRY_TREE_40810 = 40810; + public static final int SPIRITUAL_FAIRY_TREE_40811 = 40811; + public static final int SPIRITUAL_FAIRY_TREE_40812 = 40812; + public static final int SPIRITUAL_FAIRY_TREE_40813 = 40813; + public static final int SPIRITUAL_FAIRY_TREE_40814 = 40814; + public static final int SPIRITUAL_FAIRY_TREE_40815 = 40815; + public static final int SPIRITUAL_FAIRY_TREE_40816 = 40816; + public static final int SPIRITUAL_FAIRY_TREE_40817 = 40817; + public static final int SPIRITUAL_FAIRY_TREE_40818 = 40818; + public static final int SPIRITUAL_FAIRY_TREE_40819 = 40819; + public static final int SPIRITUAL_FAIRY_TREE_40820 = 40820; + public static final int SPIRITUAL_FAIRY_TREE_40821 = 40821; + public static final int SPIRITUAL_FAIRY_TREE_40822 = 40822; + public static final int SPIRITUAL_FAIRY_TREE_40823 = 40823; + public static final int SPIRITUAL_FAIRY_TREE_40824 = 40824; + public static final int SPIRITUAL_FAIRY_TREE_40825 = 40825; + public static final int SPIRITUAL_FAIRY_TREE_40826 = 40826; + public static final int SPIRITUAL_FAIRY_TREE_40827 = 40827; + public static final int SPIRITUAL_FAIRY_TREE_40828 = 40828; + public static final int SPIRITUAL_FAIRY_TREE_40829 = 40829; + public static final int SPIRITUAL_FAIRY_TREE_40830 = 40830; + public static final int SPIRITUAL_FAIRY_TREE_40831 = 40831; + public static final int SPIRITUAL_FAIRY_TREE_40832 = 40832; + public static final int SPIRITUAL_FAIRY_TREE_40833 = 40833; + public static final int SPIRITUAL_FAIRY_TREE_40834 = 40834; + public static final int SPIRITUAL_FAIRY_TREE_40835 = 40835; + public static final int SPIRITUAL_FAIRY_TREE_40836 = 40836; + public static final int SPIRITUAL_FAIRY_TREE_40837 = 40837; + public static final int SPIRITUAL_FAIRY_TREE_40838 = 40838; + public static final int SPIRITUAL_FAIRY_TREE_40839 = 40839; + public static final int SPIRITUAL_FAIRY_TREE_40840 = 40840; + public static final int SPIRITUAL_FAIRY_TREE_40841 = 40841; + public static final int SPIRITUAL_FAIRY_TREE_40842 = 40842; + public static final int SPIRITUAL_FAIRY_TREE_40843 = 40843; + public static final int FROZEN_POOL_OF_RESTORATION = 40844; + public static final int FROZEN_POOL_OF_REVITALISATION = 40845; + public static final int FROZEN_POOL_OF_REJUVENATION = 40846; + public static final int FROZEN_FANCY_POOL_OF_REJUVENATION = 40847; + public static final int FROZEN_ORNATE_POOL_OF_REJUVENATION = 40848; + public static final int SHUTTERED_WINDOW_40849 = 40849; + public static final int DECORATIVE_WINDOW_40850 = 40850; + public static final int STAINEDGLASS_WINDOW_40851 = 40851; + public static final int DECORATIVE_WINDOW_40852 = 40852; + public static final int STAINEDGLASS_WINDOW_40853 = 40853; + public static final int DECORATIVE_WINDOW_40854 = 40854; + public static final int STAINEDGLASS_WINDOW_40855 = 40855; + public static final int DECORATIVE_WINDOW_40856 = 40856; + public static final int STAINEDGLASS_WINDOW_40857 = 40857; + public static final int DOOR_40858 = 40858; + public static final int DOOR_40859 = 40859; + public static final int DOOR_40860 = 40860; + public static final int DOOR_40861 = 40861; + public static final int SACKS_40871 = 40871; + public static final int SACKS_40872 = 40872; + public static final int SACKS_40873 = 40873; + public static final int SACKS_40874 = 40874; + public static final int SACK_PILE_40875 = 40875; + public static final int SACK_PILE_40876 = 40876; + public static final int SACK_PILE_40877 = 40877; + public static final int SACK_PILE_40878 = 40878; + public static final int SHELVES_40879 = 40879; + public static final int SHELVES_40880 = 40880; + public static final int SHELVES_40881 = 40881; + public static final int SHELVES_40882 = 40882; + public static final int CUPBOARD_40883 = 40883; + public static final int CUPBOARD_40884 = 40884; + public static final int CUPBOARD_40885 = 40885; + public static final int CUPBOARD_40886 = 40886; + public static final int CAVE_ENTRANCE_40887 = 40887; + public static final int CAVE_EXIT_40888 = 40888; + public static final int CREVICE_40889 = 40889; + public static final int FIRE_REMAINS_40891 = 40891; + public static final int SLED = 40892; + public static final int SLOPE_40893 = 40893; + public static final int SLOPE_END = 40894; + public static final int PEBBLES = 40896; + public static final int BOULDER_40897 = 40897; + public static final int BOULDER_40899 = 40899; + public static final int STICK_40901 = 40901; + public static final int STICK_40902 = 40902; + public static final int CAULDRON_40903 = 40903; + public static final int TREASURE_CHEST_40904 = 40904; + public static final int ROCKS_40905 = 40905; + public static final int ROCKS_40906 = 40906; + public static final int SOCKING = 40909; + public static final int SOCKING_40910 = 40910; + public static final int SOCKING_40911 = 40911; + public static final int EVERGREEN_40932 = 40932; + public static final int EVERGREEN_40933 = 40933; + public static final int TREE_40937 = 40937; + public static final int TREE_40938 = 40938; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java index 84f265f0c2..01925a7aab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java @@ -70,7 +70,7 @@ public enum PohIcons ALTAR_13187, ALTAR_13188, ALTAR_13189, ALTAR_13190, ALTAR_13191, ALTAR_13192, ALTAR_13193, ALTAR_13194, ALTAR_13196, ALTAR_13197, ALTAR_13198, ALTAR_13199 ), - POOLS("pool", POOL_OF_RESTORATION, POOL_OF_REVITALISATION, POOL_OF_REJUVENATION, FANCY_REJUVENATION_POOL, ORNATE_REJUVENATION_POOL), + POOLS("pool", POOL_OF_RESTORATION, POOL_OF_REVITALISATION, POOL_OF_REJUVENATION, FANCY_POOL_OF_REJUVENATION, ORNATE_POOL_OF_REJUVENATION), GLORY("glory", AMULET_OF_GLORY), REPAIR("repair", ARMOUR_REPAIR_STAND), SPELLBOOKALTAR("spellbook", ANCIENT_ALTAR, LUNAR_ALTAR, DARK_ALTAR, NULL_29150), From ff0d8fcbce728d37283d4689ecc483539bcc09ed Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:21 -0700 Subject: [PATCH 069/173] Update NPC IDs to 2020-12-9 --- .../src/main/java/net/runelite/api/NpcID.java | 40 +++++++++++++++++++ .../main/java/net/runelite/api/NullNpcID.java | 15 +++++++ 2 files changed, 55 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index bae73caa99..cb028faaad 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -8889,5 +8889,45 @@ public final class NpcID public static final int ORNATE_KURASK_COMBAT_DUMMY = 10510; public static final int ORNATE_UNDEAD_COMBAT_DUMMY_10511 = 10511; public static final int ORNATE_UNDEAD_COMBAT_DUMMY_10512 = 10512; + public static final int FISHING_SPOT_10513 = 10513; + public static final int FISHING_SPOT_10514 = 10514; + public static final int FISHING_SPOT_10515 = 10515; + public static final int NOMAD = 10516; + public static final int ZIMBERFIZZ = 10517; + public static final int ZIMBERFIZZ_10518 = 10518; + public static final int ZIMBERFIZZ_10519 = 10519; + public static final int AVATAR_OF_CREATION = 10520; + public static final int AVATAR_OF_DESTRUCTION = 10521; + public static final int WOLF_10522 = 10522; + public static final int FORGOTTEN_SOUL = 10523; + public static final int FORGOTTEN_SOUL_10524 = 10524; + public static final int FORGOTTEN_SOUL_10525 = 10525; + public static final int FORGOTTEN_SOUL_10526 = 10526; + public static final int NOMAD_10528 = 10528; + public static final int NOMAD_10529 = 10529; + public static final int ZIMBERFIZZ_10530 = 10530; + public static final int AVATAR_OF_CREATION_10531 = 10531; + public static final int AVATAR_OF_DESTRUCTION_10532 = 10532; + public static final int WOLF_10533 = 10533; + public static final int FORGOTTEN_SOUL_10534 = 10534; + public static final int FORGOTTEN_SOUL_10535 = 10535; + public static final int FORGOTTEN_SOUL_10536 = 10536; + public static final int FORGOTTEN_SOUL_10537 = 10537; + public static final int GHOST_10538 = 10538; + public static final int BARRICADE_10539 = 10539; + public static final int BARRICADE_10540 = 10540; + public static final int BIRD_10541 = 10541; + public static final int FORGOTTEN_SOUL_10544 = 10544; + public static final int FORGOTTEN_SOUL_10545 = 10545; + public static final int DUCK_10546 = 10546; + public static final int DUCK_10547 = 10547; + public static final int SCRUBFOOT = 10558; + public static final int SCRUBFOOT_10559 = 10559; + public static final int RED_FIREFLIES = 10561; + public static final int RED_FIREFLIES_10562 = 10562; + public static final int GREEN_FIREFLIES = 10564; + public static final int GREEN_FIREFLIES_10565 = 10565; + public static final int GOBLIN_10566 = 10566; + public static final int GOBLIN_10567 = 10567; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java index 32f4672ce5..ebc7194221 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java @@ -1607,5 +1607,20 @@ public final class NullNpcID public static final int NULL_10441 = 10441; public static final int NULL_10474 = 10474; public static final int NULL_10475 = 10475; + public static final int NULL_10527 = 10527; + public static final int NULL_10542 = 10542; + public static final int NULL_10543 = 10543; + public static final int NULL_10548 = 10548; + public static final int NULL_10549 = 10549; + public static final int NULL_10550 = 10550; + public static final int NULL_10551 = 10551; + public static final int NULL_10552 = 10552; + public static final int NULL_10553 = 10553; + public static final int NULL_10554 = 10554; + public static final int NULL_10555 = 10555; + public static final int NULL_10556 = 10556; + public static final int NULL_10557 = 10557; + public static final int NULL_10560 = 10560; + public static final int NULL_10563 = 10563; /* This file is automatically generated. Do not edit. */ } From 6aa085fc3e46b482988ca615a73dbafc13f34dc9 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Tue, 8 Dec 2020 14:23:29 -0700 Subject: [PATCH 070/173] Update Widget IDs to 2020-12-9 --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 00fe32bef1..dd6a8eac0a 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -886,10 +886,10 @@ public class WidgetID static class SettingsSide { - static final int CAMERA_ZOOM_SLIDER_TRACK = 54; - static final int MUSIC_SLIDER = 10; - static final int SOUND_EFFECT_SLIDER = 14; - static final int AREA_SOUND_SLIDER = 18; + static final int CAMERA_ZOOM_SLIDER_TRACK = 59; + static final int MUSIC_SLIDER = 13; + static final int SOUND_EFFECT_SLIDER = 17; + static final int AREA_SOUND_SLIDER = 21; } static class Settings From dc84f6b6497270875af861b20e22902d32031416 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 7 Dec 2020 13:40:49 -0500 Subject: [PATCH 071/173] api: move sound effect volumes to preferences --- .../main/java/net/runelite/api/Client.java | 24 ------------------- .../java/net/runelite/api/Preferences.java | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 580b16b1f3..2fc2be3edc 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1022,30 +1022,6 @@ public interface Client extends GameEngine */ void setMusicVolume(int volume); - /** - * Gets the sound effect volume - * @return volume 0-127 inclusive - */ - int getSoundEffectVolume(); - - /** - * Sets the sound effect volume - * @param volume 0-127 inclusive - */ - void setSoundEffectVolume(int volume); - - /** - * Gets the area sound effect volume - * @return volume 0-127 inclusive - */ - int getAreaSoundEffectVolume(); - - /** - * Sets the area sound effect volume - * @param volume 0-127 inclusive - */ - void setAreaSoundEffectVolume(int volume); - /** * Play a sound effect at the player's current location. This is how UI, * and player-generated (e.g. mining, woodcutting) sound effects are diff --git a/runelite-api/src/main/java/net/runelite/api/Preferences.java b/runelite-api/src/main/java/net/runelite/api/Preferences.java index ec1fb0dad7..d7b67242bf 100644 --- a/runelite-api/src/main/java/net/runelite/api/Preferences.java +++ b/runelite-api/src/main/java/net/runelite/api/Preferences.java @@ -42,4 +42,28 @@ public interface Preferences * @param username the new remembered username */ void setRememberedUsername(String username); + + /** + * Gets the sound effect volume + * @return volume 0-127 inclusive + */ + int getSoundEffectVolume(); + + /** + * Sets the sound effect volume + * @param volume 0-127 inclusive + */ + void setSoundEffectVolume(int volume); + + /** + * Gets the area sound effect volume + * @return volume 0-127 inclusive + */ + int getAreaSoundEffectVolume(); + + /** + * Sets the area sound effect volume + * @param volume 0-127 inclusive + */ + void setAreaSoundEffectVolume(int volume); } From 45ae2fa3f6db9c21cb37c3c1a14431010ec82ed0 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 7 Dec 2020 13:42:49 -0500 Subject: [PATCH 072/173] metronome: update for volume api changes --- .../client/plugins/metronome/MetronomePlugin.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java index 85a502955a..0723bb1df0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java @@ -28,6 +28,7 @@ package net.runelite.client.plugins.metronome; import com.google.inject.Provides; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.Preferences; import net.runelite.api.SoundEffectID; import net.runelite.api.events.GameTick; import net.runelite.client.config.ConfigManager; @@ -77,20 +78,21 @@ public class MetronomePlugin extends Plugin { // As playSoundEffect only uses the volume argument when the in-game volume isn't muted, sound effect volume // needs to be set to the value desired for ticks or tocks and afterwards reset to the previous value. - int previousVolume = client.getSoundEffectVolume(); + Preferences preferences = client.getPreferences(); + int previousVolume = preferences.getSoundEffectVolume(); if (shouldTock && config.tockVolume() > 0) { - client.setSoundEffectVolume(config.tockVolume()); + preferences.setSoundEffectVolume(config.tockVolume()); client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, config.tockVolume()); } else if (config.tickVolume() > 0) { - client.setSoundEffectVolume(config.tickVolume()); + preferences.setSoundEffectVolume(config.tickVolume()); client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP, config.tickVolume()); } - client.setSoundEffectVolume(previousVolume); + preferences.setSoundEffectVolume(previousVolume); shouldTock = !shouldTock; } From b9b87d10a449df7ebfea062219d6708616a664dd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 7 Dec 2020 19:15:17 -0500 Subject: [PATCH 073/173] music: update for volume api changes --- .../java/net/runelite/client/plugins/music/MusicPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index ca140e2bd4..63e6fe2f2c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -49,6 +49,7 @@ import net.runelite.api.GameState; import net.runelite.api.NPC; import net.runelite.api.ParamID; import net.runelite.api.Player; +import net.runelite.api.Preferences; import net.runelite.api.ScriptEvent; import net.runelite.api.ScriptID; import net.runelite.api.SettingID; @@ -168,6 +169,7 @@ public class MusicPlugin extends Plugin { this.shuttingDown = false; + Preferences preferences = client.getPreferences(); musicChannel = new Channel("Music", VarPlayer.MUSIC_VOLUME, Varbits.MUTED_MUSIC_VOLUME, musicConfig::getMusicVolume, musicConfig::setMusicVolume, @@ -176,12 +178,12 @@ public class MusicPlugin extends Plugin effectChannel = new Channel("Sound Effects", VarPlayer.SOUND_EFFECT_VOLUME, Varbits.MUTED_SOUND_EFFECT_VOLUME, musicConfig::getSoundEffectVolume, musicConfig::setSoundEffectVolume, - client::setSoundEffectVolume, 127, + preferences::setSoundEffectVolume, 127, WidgetInfo.SETTINGS_SIDE_SOUND_EFFECT_SLIDER); areaChannel = new Channel("Area Sounds", VarPlayer.AREA_EFFECT_VOLUME, Varbits.MUTED_AREA_EFFECT_VOLUME, musicConfig::getAreaSoundEffectVolume, musicConfig::setAreaSoundEffectVolume, - client::setAreaSoundEffectVolume, 127, + preferences::setAreaSoundEffectVolume, 127, WidgetInfo.SETTINGS_SIDE_AREA_SOUND_SLIDER); channels = new Channel[]{musicChannel, effectChannel, areaChannel}; From 3ac711ebf71eb3f08cb78ddc1be1da9c81d717c5 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 9 Dec 2020 12:22:39 +0000 Subject: [PATCH 074/173] Release 1.6.35 --- 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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 01ba078ab9..82784fd788 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index b5733dc74b..1216cdbd63 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 3cf7676ba7..700d632a0e 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index c0c3d01c06..210c343971 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index dc9b9315ff..2723540dd0 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 Web Service diff --git a/pom.xml b/pom.xml index 9ce3b39a15..f41993f53d 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.6.35 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 1af56d1208..114c26581e 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 524d9de239..178359f9d6 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index bf5681f157..640d770ab9 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.34-SNAPSHOT + 1.6.35 script-assembler-plugin From 096f457d9f5f7f0867de7931138837015f21710c Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 9 Dec 2020 12:22:49 +0000 Subject: [PATCH 075/173] Bump for 1.6.36-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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 82784fd788..7237ada310 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 1216cdbd63..3ff21397e4 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 700d632a0e..a1504d9cf6 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 210c343971..d26c2d8144 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 2723540dd0..4ff5310d69 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index f41993f53d..58d4067acf 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.6.35 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 114c26581e..c7f83d7b0a 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 178359f9d6..afb140a94a 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 640d770ab9..b8e3ef2786 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.35 + 1.6.36-SNAPSHOT script-assembler-plugin From 807a22172f0fd09a89f1e72e35e5eb7fb6816881 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 9 Dec 2020 19:49:01 -0500 Subject: [PATCH 076/173] barrows: fix reward potential color overlay The reward text color is meant to show what is the optimal reward percent for money, assuming that blood runes are best, and death runes are second best. The percentage thresholds however were incorrect. --- .../barrows/BarrowsBrotherSlainOverlay.java | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java index b3cceb6d66..22103f5e79 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java @@ -83,13 +83,42 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel .build()); } - float rewardPercent = client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) / 10.0f; + final int rewardPotential = rewardPotential(); + float rewardPercent = rewardPotential / 10.12f; panelComponent.getChildren().add(LineComponent.builder() - .left("Potential") - .right(rewardPercent != 0 ? rewardPercent + "%" : "0%") - .rightColor(rewardPercent >= 73.0f && rewardPercent <= 88.0f ? Color.GREEN : rewardPercent < 65.6f ? Color.WHITE : Color.YELLOW) - .build()); + .left("Potential") + .right(rewardPercent != 0 ? rewardPercent + "%" : "0%") + .rightColor(rewardPotential >= 756 && rewardPotential < 881 ? Color.GREEN : rewardPotential < 631 ? Color.WHITE : Color.YELLOW) + .build()); return super.render(graphics); } + + /** + * Compute the barrows reward potential. Potential rewards are based off of the amount of + * potential. + *

    + * The reward potential thresholds are as follows: + * Mind rune - 381 + * Chaos rune - 506 + * Death rune - 631 + * Blood rune - 756 + * Bolt rack - 881 + * Half key - 1006 + * Dragon med - 1012 + * + * @return potential, 0-1012 inclusive + * @see source + */ + private int rewardPotential() + { + // this is from [proc,barrows_overlay_reward] + int brothers = client.getVar(Varbits.BARROWS_KILLED_AHRIM) + + client.getVar(Varbits.BARROWS_KILLED_DHAROK) + + client.getVar(Varbits.BARROWS_KILLED_GUTHAN) + + client.getVar(Varbits.BARROWS_KILLED_KARIL) + + client.getVar(Varbits.BARROWS_KILLED_TORAG) + + client.getVar(Varbits.BARROWS_KILLED_VERAC); + return client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) + brothers * 2; + } } From c2d5165709352c492499676a41e19c02bba47380 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 9 Dec 2020 19:16:49 -0500 Subject: [PATCH 077/173] twitch: fix npe closing client if no socket has been created If the client is closed prior to the socket being created, or if socket creation fails, this will repeatedly throw out of close() in connect() and is never able to reestablish a connection --- .../runelite/client/plugins/twitch/irc/TwitchIRCClient.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java index 2361dd2e97..53f8d461e4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java @@ -68,7 +68,10 @@ public class TwitchIRCClient extends Thread implements AutoCloseable { try { - socket.close(); + if (socket != null) + { + socket.close(); + } } catch (IOException ex) { From aa81261e5d708250bd373500e1b4c2e150513d35 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Sat, 14 Nov 2020 15:19:37 -0500 Subject: [PATCH 078/173] discord: add a few missing regions --- .../client/plugins/discord/DiscordGameEventType.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java index e298743344..d5a728a368 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java @@ -186,12 +186,15 @@ enum DiscordGameEventType DUNGEON_CORSAIR_COVE("Corsair Cove Dungeon", DiscordAreaType.DUNGEONS, 8076, 8332), DUNGEON_CRABCLAW_CAVES("Crabclaw Caves", DiscordAreaType.DUNGEONS, 6553, 6809), DUNGEON_CRANDOR("Crandor Dungeon", DiscordAreaType.DUNGEONS, 11414), + DUNGEON_CRASH_SITE_CAVERN("Crash Site Cavern", DiscordAreaType.DUNGEONS, 8280, 8536), + DUNGEON_DAEYALT_ESSENCE_MINE("Daeyalt Essence Mine", DiscordAreaType.DUNGEONS, 14744), DUNGEON_DIGSITE("Digsite Dungeon", DiscordAreaType.DUNGEONS, 13464, 13465), DUNGEON_DORGESHKAAN("Dorgesh-Kaan South Dungeon", DiscordAreaType.DUNGEONS, 10833), DUNGEON_DORGESHUUN_MINES("Dorgeshuun Mines", DiscordAreaType.DUNGEONS, 12950, 13206), DUNGEON_DRAYNOR_SEWERS("Draynor Sewers", DiscordAreaType.DUNGEONS, 12439, 12438), DUNGEON_DWARVEN_MINES("Dwarven Mines", DiscordAreaType.DUNGEONS, 12185, 12184, 12183), DUNGEON_EAGLES_PEAK("Eagles' Peak Dungeon", DiscordAreaType.DUNGEONS, 8013), + DUNGEON_ECTOFUNTUS("Ectofuntus", DiscordAreaType.DUNGEONS, 14746), DUNGEON_EDGEVILLE("Edgeville Dungeon", DiscordAreaType.DUNGEONS, 12441, 12442, 12443, 12698), DUNGEON_ELEMENTAL_WORKSHOP("Elemental Workshop", DiscordAreaType.DUNGEONS, 10906, 7760), DUNGEON_ENAKHRAS_TEMPLE("Enakhra's Temple", DiscordAreaType.DUNGEONS, 12423), @@ -221,6 +224,7 @@ enum DiscordGameEventType DUNGEON_LUMBRIDGE_SWAMP_CAVES("Lumbridge Swamp Caves", DiscordAreaType.DUNGEONS, 12693, 12949), DUNGEON_LUNAR_ISLE_MINE("Lunar Isle Mine", DiscordAreaType.DUNGEONS, 9377), DUNGEON_MANIACAL_HUNTER("Maniacal Monkey Hunter Area", DiscordAreaType.DUNGEONS, 11662), + DUNGEON_MEIYERDITCH_MINE("Meiyerditch Mine", DiscordAreaType.DUNGEONS, 9544), DUNGEON_MISCELLANIA("Miscellania Dungeon", DiscordAreaType.DUNGEONS, 10144, 10400), DUNGEON_MOGRE_CAMP("Mogre Camp", DiscordAreaType.DUNGEONS, 11924), DUNGEON_MOS_LE_HARMLESS_CAVES("Mos Le'Harmless Caves", DiscordAreaType.DUNGEONS, 14994, 14995, 15251), @@ -369,6 +373,7 @@ enum DiscordGameEventType REGION_KEBOS_SWAMP("Kebos Swamp", DiscordAreaType.REGIONS, 4664, 4920, 5174, 5175, 5176, 5430, 5431), REGION_KHARAZI_JUNGLE("Kharazi Jungle", DiscordAreaType.REGIONS, 11053, 11309, 11565, 11821), REGION_KHARIDIAN_DESERT("Kharidian Desert", DiscordAreaType.REGIONS, 12844, 12845, 12846, 12847, 12848, 13100, 13101, 13102, 13103, 13104, 13357, 13359, 13360, 13614, 13615, 13616), + REGION_KILLERWATT_PLANE("Killerwatt Plane", DiscordAreaType.REGIONS, 10577), REGION_KOUREND("Great Kourend", DiscordAreaType.REGIONS, 6201, 6457, 6713), REGION_KOUREND_WOODLAND("Kourend Woodland", DiscordAreaType.REGIONS, 5942, 6197, 6453), REGION_LAW_ALTAR("Law Altar", DiscordAreaType.REGIONS, 9803), From f9594e52955a0294b472d75603ab5f8730b5a275 Mon Sep 17 00:00:00 2001 From: Paveldin <40346808+Paveldin@users.noreply.github.com> Date: Sat, 12 Dec 2020 13:52:17 -0500 Subject: [PATCH 079/173] fishing: Add crystal and trailblazer harpoon to fishing tool list (#12829) --- .../net/runelite/client/plugins/fishing/FishingPlugin.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java index 8c424f4618..65257adeb8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java @@ -274,6 +274,11 @@ public class FishingPlugin extends Plugin case ItemID.KARAMBWAN_VESSEL_3159: case ItemID.CORMORANTS_GLOVE: case ItemID.CORMORANTS_GLOVE_22817: + case ItemID.TRAILBLAZER_HARPOON: + case ItemID.TRAILBLAZER_HARPOON_25114: + case ItemID.CRYSTAL_HARPOON: + case ItemID.CRYSTAL_HARPOON_23864: + case ItemID.CRYSTAL_HARPOON_INACTIVE: return true; } } From fa0c5066d3635d80248b319ed1491e1aecb56e5b Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 8 Oct 2020 13:53:13 +0100 Subject: [PATCH 080/173] WidgetOverlay: Make Multicombat Indicator moveable --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 ++ .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 3 +++ .../java/net/runelite/client/ui/overlay/WidgetOverlay.java | 2 ++ 3 files changed, 7 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index dd6a8eac0a..c2a61de5e4 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -371,6 +371,7 @@ public class WidgetID { static final int MINIMAP = 3; static final int MINIMAP_DRAW_AREA = 8; + static final int MULTICOMBAT_INDICATOR = 21; static final int FRIENDS_CHAT_TAB = 34; static final int FRIENDS_TAB = 36; static final int IGNORES_TAB = 35; @@ -407,6 +408,7 @@ public class WidgetID static class ResizableViewport { + static final int MULTICOMBAT_INDICATOR = 18; static final int FRIENDS_CHAT_TAB = 38; static final int FRIENDS_TAB = 40; static final int IGNORES_TAB = 39; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index f07b5cb523..50bc1d2171 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -549,6 +549,9 @@ public enum WidgetInfo HEALTH_OVERLAY_BAR(WidgetID.HEALTH_OVERLAY_BAR_GROUP_ID, WidgetID.EncounterHealthBar.CONTAINER), TRAILBLAZER_AREA_TELEPORT(WidgetID.TRAILBLAZER_AREAS_GROUP_ID, WidgetID.TrailblazerAreas.TELEPORT), + + MULTICOMBAT_FIXED(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.MULTICOMBAT_INDICATOR), + MULTICOMBAT_RESIZEABLE(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewport.MULTICOMBAT_INDICATOR), ; private final int groupId; diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index c10de61e55..66264c4e37 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -64,6 +64,8 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.NIGHTMARE_PILLAR_HEALTH, OverlayPosition.TOP_LEFT) .put(WidgetInfo.VOLCANIC_MINE_VENTS_INFOBOX_GROUP, OverlayPosition.BOTTOM_RIGHT) .put(WidgetInfo.VOLCANIC_MINE_STABILITY_INFOBOX_GROUP, OverlayPosition.BOTTOM_LEFT) + .put(WidgetInfo.MULTICOMBAT_FIXED, OverlayPosition.BOTTOM_RIGHT) + .put(WidgetInfo.MULTICOMBAT_RESIZEABLE, OverlayPosition.CANVAS_TOP_RIGHT) .build(); public static Collection createOverlays(final Client client) From eaa16429e575c343ca7107cf27d7804e70530092 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Dec 2020 16:10:56 -0500 Subject: [PATCH 081/173] widget overlay: use the in-game configured position for the xptracker widget --- .../client/ui/overlay/WidgetOverlay.java | 109 ++++++++++++------ 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index 66264c4e37..468f195519 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -24,58 +24,52 @@ */ package net.runelite.client.ui.overlay; -import com.google.common.collect.ImmutableMap; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; +import java.util.Arrays; import java.util.Collection; -import java.util.Map; import java.util.Objects; -import java.util.stream.Collectors; import net.runelite.api.Client; +import net.runelite.api.Varbits; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; public class WidgetOverlay extends Overlay { - private static final Map WIDGETS = ImmutableMap - .builder() - .put(WidgetInfo.RESIZABLE_MINIMAP_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT) - .put(WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT) - .put(WidgetInfo.FOSSIL_ISLAND_OXYGENBAR, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.EXPERIENCE_TRACKER_WIDGET, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.RAIDS_POINTS_INFOBOX, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.TOB_PARTY_INTERFACE, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.TOB_PARTY_STATS, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.GWD_KC, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.TITHE_FARM, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.PEST_CONTROL_BOAT_INFO, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER) - .put(WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER) - .put(WidgetInfo.LMS_INFO, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.LMS_KDA, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.GAUNTLET_TIMER_CONTAINER, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.HALLOWED_SEPULCHRE_TIMER_CONTAINER, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.HEALTH_OVERLAY_BAR, OverlayPosition.TOP_CENTER) - .put(WidgetInfo.NIGHTMARE_PILLAR_HEALTH, OverlayPosition.TOP_LEFT) - .put(WidgetInfo.VOLCANIC_MINE_VENTS_INFOBOX_GROUP, OverlayPosition.BOTTOM_RIGHT) - .put(WidgetInfo.VOLCANIC_MINE_STABILITY_INFOBOX_GROUP, OverlayPosition.BOTTOM_LEFT) - .put(WidgetInfo.MULTICOMBAT_FIXED, OverlayPosition.BOTTOM_RIGHT) - .put(WidgetInfo.MULTICOMBAT_RESIZEABLE, OverlayPosition.CANVAS_TOP_RIGHT) - .build(); - public static Collection createOverlays(final Client client) { - return WIDGETS.entrySet().stream() - .map(w -> new WidgetOverlay(client, w.getKey(), w.getValue())) - .collect(Collectors.toList()); + return Arrays.asList( + new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.FOSSIL_ISLAND_OXYGENBAR, OverlayPosition.TOP_LEFT), + new XpTrackerWidgetOverlay(client, WidgetInfo.EXPERIENCE_TRACKER_WIDGET, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.RAIDS_POINTS_INFOBOX, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.TOB_PARTY_INTERFACE, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.TOB_PARTY_STATS, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.GWD_KC, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.TITHE_FARM, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.PEST_CONTROL_BOAT_INFO, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER), + new WidgetOverlay(client, WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER), + new WidgetOverlay(client, WidgetInfo.LMS_INFO, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.LMS_KDA, OverlayPosition.TOP_RIGHT), + new WidgetOverlay(client, WidgetInfo.GAUNTLET_TIMER_CONTAINER, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.HALLOWED_SEPULCHRE_TIMER_CONTAINER, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.HEALTH_OVERLAY_BAR, OverlayPosition.TOP_CENTER), + new WidgetOverlay(client, WidgetInfo.NIGHTMARE_PILLAR_HEALTH, OverlayPosition.TOP_LEFT), + new WidgetOverlay(client, WidgetInfo.VOLCANIC_MINE_VENTS_INFOBOX_GROUP, OverlayPosition.BOTTOM_RIGHT), + new WidgetOverlay(client, WidgetInfo.VOLCANIC_MINE_STABILITY_INFOBOX_GROUP, OverlayPosition.BOTTOM_LEFT), + new WidgetOverlay(client, WidgetInfo.MULTICOMBAT_FIXED, OverlayPosition.BOTTOM_RIGHT), + new WidgetOverlay(client, WidgetInfo.MULTICOMBAT_RESIZEABLE, OverlayPosition.CANVAS_TOP_RIGHT) + ); } - private final Client client; + protected final Client client; private final WidgetInfo widgetInfo; private final Rectangle parentBounds = new Rectangle(); @@ -169,4 +163,45 @@ public class WidgetOverlay extends Overlay parentBounds.setBounds(bounds); return bounds; } + + private static class XpTrackerWidgetOverlay extends WidgetOverlay + { + private XpTrackerWidgetOverlay(Client client, WidgetInfo widgetInfo, OverlayPosition overlayPosition) + { + super(client, widgetInfo, overlayPosition); + } + + /** + * Get the overlay position of the xptracker based on the configured location in-game. + * + * @return + */ + @Override + public OverlayPosition getPosition() + { + if (!client.isClientThread()) + { + // During overlay drag, getPosition() is called on the EDT, so we just + // cache and reuse the last known configured position. + return super.getPosition(); + } + + OverlayPosition position; + switch (client.getVar(Varbits.EXPERIENCE_TRACKER_POSITION)) + { + case 0: + default: + position = OverlayPosition.TOP_RIGHT; + break; + case 1: + position = OverlayPosition.TOP_CENTER; + break; + case 2: + position = OverlayPosition.TOP_LEFT; + break; + } + setPosition(position); + return position; + } + } } From 0bf7f33ee0b7a3b9907a280b5f362f784945dffc Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Dec 2020 17:14:55 -0500 Subject: [PATCH 082/173] devtools: assign unique names to debug infoboxes --- .../client/plugins/devtools/DevToolsPanel.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java index 0d599bb1fd..7ee247f92c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java @@ -174,7 +174,15 @@ class DevToolsPanel extends PluginPanel final JButton newInfoboxBtn = new JButton("Infobox"); newInfoboxBtn.addActionListener(e -> { - Counter counter = new Counter(ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"), plugin, 42); + Counter counter = new Counter(ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"), plugin, 42) + { + @Override + public String getName() + { + // Give the infobox a unique name to test infobox splitting + return "devtools-" + hashCode(); + } + }; counter.getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_INFOBOX, "Test", "DevTools")); infoBoxManager.addInfoBox(counter); }); From 59bccf2c6f3d6b6f39bf66933b72135dfe019d7c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Dec 2020 17:25:30 -0500 Subject: [PATCH 083/173] overlay renderer: set currentManagedOverlay also when clicking Requiring the mouse to be moved first causes dead clicks when the mouse is pressed immediately after entering overlay management mode. Also since resetOverlayManagementMode() clears the managed overlay, after dragging an overlay it again requires the mouse to be moved to pick up a click on it if dragging again or trying to reset the overlay. --- .../client/ui/overlay/OverlayRenderer.java | 51 +++++++++++-------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 1b886f4ec9..d2a4e135a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -344,6 +344,9 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener final Point mousePoint = mouseEvent.getPoint(); mousePosition.setLocation(mousePoint); + // See if we've clicked on an overlay + currentManagedOverlay = findMangedOverlay(mousePoint); + if (currentManagedOverlay == null) { return mouseEvent; @@ -389,26 +392,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener if (!inOverlayResizingMode && !inOverlayDraggingMode) { - currentManagedOverlay = null; - - synchronized (overlayManager) - { - for (Overlay overlay : overlayManager.getOverlays()) - { - if (overlay.getPosition() == OverlayPosition.DYNAMIC || overlay.getPosition() == OverlayPosition.TOOLTIP) - { - // never allow moving dynamic or tooltip overlays - continue; - } - - final Rectangle bounds = overlay.getBounds(); - if (bounds.contains(mousePoint)) - { - currentManagedOverlay = overlay; - break; - } - } - } + currentManagedOverlay = findMangedOverlay(mousePoint); } if (currentManagedOverlay == null || !currentManagedOverlay.isResizable()) @@ -455,6 +439,33 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener return mouseEvent; } + /** + * Find an overlay to manage which is under the given mouse point + * @param mousePoint + * @return + */ + private Overlay findMangedOverlay(Point mousePoint) + { + synchronized (overlayManager) + { + for (Overlay overlay : overlayManager.getOverlays()) + { + if (overlay.getPosition() == OverlayPosition.DYNAMIC || overlay.getPosition() == OverlayPosition.TOOLTIP) + { + // never allow moving dynamic or tooltip overlays + continue; + } + + final Rectangle bounds = overlay.getBounds(); + if (bounds.contains(mousePoint)) + { + return overlay; + } + } + } + return null; + } + @Override public MouseEvent mouseDragged(MouseEvent mouseEvent) { From 70a2e41db0187cba6ab3fcd08e7d71c74ed63ecd Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 12 Dec 2020 16:15:17 -0500 Subject: [PATCH 084/173] Allow overlay renderer to restrict overlay parent bounds This removes the hack of double setting the widget position in WidgetOverlay, which was required to override the overlay renderers clamping code in both overlay drag and in overlay rendering. --- .../runelite/client/ui/overlay/Overlay.java | 11 ++++ .../client/ui/overlay/OverlayRenderer.java | 57 +++++++++++++------ .../client/ui/overlay/WidgetOverlay.java | 54 ++++++------------ 3 files changed, 69 insertions(+), 53 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java index 303b423a6a..405fe28080 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java @@ -97,4 +97,15 @@ public abstract class Overlay implements LayoutableRenderableEntity { return false; } + + /** + * Get the parent bounds for overlay dragging. The overlay will + * not be allowed to be moved outside of the parent bounds. + * @return + */ + @Nullable + public Rectangle getParentBounds() + { + return null; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index d2a4e135a2..6b6c01add2 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -246,11 +246,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } else { - final Point location = overlay.getBounds().getLocation(); - final Dimension dimension = overlay.getBounds().getSize(); + final Rectangle bounds = overlay.getBounds(); + final Point location = bounds.getLocation(); + final Dimension dimension = bounds.getSize(); + + final Point preferredLocation = overlay.getPreferredLocation(); // If the final position is not modified, layout it - if (overlayPosition != OverlayPosition.DETACHED && (overlay.getPreferredLocation() == null || overlay.getPreferredPosition() != null)) + if (overlayPosition != OverlayPosition.DETACHED && (preferredLocation == null || overlay.getPreferredPosition() != null)) { final Rectangle snapCorner = snapCorners.forPosition(overlayPosition); final Point translation = OverlayUtil.transformPosition(overlayPosition, dimension); @@ -260,21 +263,18 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } else { - final Point preferredLocation = overlay.getPreferredLocation(); - if (preferredLocation != null) { location.setLocation(preferredLocation); } - final Dimension realDimensions = client.getRealDimensions(); - location.x = Ints.constrainToRange(location.x, 0, Math.max(0, realDimensions.width - dimension.width)); - location.y = Ints.constrainToRange(location.y, 0, Math.max(0, realDimensions.height - dimension.height)); + // Clamp the overlay position to ensure it is on screen or within parent bounds + clampOverlayLocation(location, dimension.width, dimension.height, overlay); } if (overlay.getPreferredSize() != null) { - overlay.getBounds().setSize(overlay.getPreferredSize()); + bounds.setSize(overlay.getPreferredSize()); } safeRender(client, overlay, layer, graphics, location); @@ -287,8 +287,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener graphics.setRenderingHints(renderingHints); graphics.setBackground(background); - final Rectangle bounds = overlay.getBounds(); - if (!bounds.isEmpty()) { if (inOverlayManagingMode) @@ -583,12 +581,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } else if (inOverlayDraggingMode) { - final Dimension realDimension = client.getRealDimensions(); - p.translate(-overlayOffset.x, -overlayOffset.y); - p.x = Ints.constrainToRange(p.x, 0, Math.max(0, realDimension.width - currentManagedOverlay.getBounds().width)); - p.y = Ints.constrainToRange(p.y, 0, Math.max(0, realDimension.height - currentManagedOverlay.getBounds().height)); + Point overlayPosition = new Point(p); + overlayPosition.translate(-overlayOffset.x, -overlayOffset.y); // adjust by mouse offset to get overlay position + + // Clamp drag to parent component + final Rectangle overlayBounds = currentManagedOverlay.getBounds(); + clampOverlayLocation(overlayPosition, overlayBounds.width, overlayBounds.height, currentManagedOverlay); currentManagedOverlay.setPreferredPosition(null); - currentManagedOverlay.setPreferredLocation(p); + currentManagedOverlay.setPreferredLocation(overlayPosition); } else { @@ -887,4 +887,29 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener return entries; } + + /** + * Adjust the given overlay position to be within its parent's bounds. + * + * @param overlayPosition the overlay position, which is modified in place + * @param overlayWidth + * @param overlayHeight + * @param overlay the overlay + */ + private void clampOverlayLocation(Point overlayPosition, int overlayWidth, int overlayHeight, Overlay overlay) + { + Rectangle parentBounds = overlay.getParentBounds(); + if (parentBounds == null || parentBounds.isEmpty()) + { + // If no bounds are set, use the full client bounds + Dimension dim = client.getRealDimensions(); + parentBounds = new Rectangle(0, 0, dim.width, dim.height); + } + + // Constrain overlay position to be within the parent bounds + overlayPosition.x = Ints.constrainToRange(overlayPosition.x, parentBounds.x, + Math.max(parentBounds.x, parentBounds.width - overlayWidth)); + overlayPosition.y = Ints.constrainToRange(overlayPosition.y, parentBounds.y, + Math.max(parentBounds.y, parentBounds.height - overlayHeight)); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index 468f195519..d5f57d6590 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -88,32 +88,10 @@ public class WidgetOverlay extends Overlay return Objects.toString(widgetInfo); } - @Override - public Rectangle getBounds() - { - final Rectangle bounds = super.getBounds(); - final Rectangle parent = getParentBounds(client.getWidget(widgetInfo)); - - if (parent.isEmpty()) - { - return bounds; - } - - int x = bounds.x; - int y = bounds.y; - x = Math.max(parent.x, x); - y = Math.max(parent.y, y); - x = Math.min((int)parent.getMaxX() - bounds.width, x); - y = Math.min((int)parent.getMaxY() - bounds.height, y); - bounds.setLocation(x, y); - return bounds; - } - @Override public Dimension render(Graphics2D graphics) { final Widget widget = client.getWidget(widgetInfo); - final Rectangle bounds = super.getBounds(); final Rectangle parent = getParentBounds(widget); if (parent.isEmpty()) @@ -121,15 +99,8 @@ public class WidgetOverlay extends Overlay return null; } - int x = bounds.x; - int y = bounds.y; - x = Math.max(parent.x, x); - y = Math.max(parent.y, y); - x = Math.min((int)parent.getMaxX() - bounds.width, x); - y = Math.min((int)parent.getMaxY() - bounds.height, y); - bounds.setLocation(x, y); - widget.setOriginalX(0); - widget.setOriginalY(0); + final Rectangle bounds = getBounds(); + // The widget relative pos is relative to the parent widget.setRelativeX(bounds.x - parent.x); widget.setRelativeY(bounds.y - parent.y); return new Dimension(widget.getWidth(), widget.getHeight()); @@ -137,11 +108,6 @@ public class WidgetOverlay extends Overlay private Rectangle getParentBounds(final Widget widget) { - if (!client.isClientThread()) - { - return parentBounds; - } - if (widget == null || widget.isHidden()) { parentBounds.setBounds(new Rectangle()); @@ -157,13 +123,27 @@ public class WidgetOverlay extends Overlay } else { - bounds = new Rectangle(parent.getCanvasLocation().getX(), parent.getCanvasLocation().getY(), parent.getWidth(), parent.getHeight()); + bounds = parent.getBounds(); } parentBounds.setBounds(bounds); return bounds; } + @Override + public Rectangle getParentBounds() + { + if (!client.isClientThread()) + { + // During overlay drag this is called on the EDT, so we just + // cache and reuse the last known parent bounds. + return parentBounds; + } + + final Widget widget = client.getWidget(widgetInfo); + return getParentBounds(widget); + } + private static class XpTrackerWidgetOverlay extends WidgetOverlay { private XpTrackerWidgetOverlay(Client client, WidgetInfo widgetInfo, OverlayPosition overlayPosition) From e6169ab79b5923213dac57bb5c68663e5f7a265b Mon Sep 17 00:00:00 2001 From: dekvall Date: Tue, 3 Nov 2020 21:12:03 +0100 Subject: [PATCH 085/173] zalcano: add damage counter Adds a panel which tracks damage dealt to Zalcano's health and shield to make it easier prioritising what to focus on at a low level. Co-authored-by: Adam --- .../main/java/net/runelite/api/VarPlayer.java | 9 +- .../client/plugins/zalcano/ZalcanoPanel.java | 85 ++++++++++++++++++ .../client/plugins/zalcano/ZalcanoPlugin.java | 86 ++++++++++++++++++- 3 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPanel.java diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index a18acd81ba..d4653aeb9c 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -185,7 +185,14 @@ public enum VarPlayer /** * 0 = 2 buttons, 1 = 1 button */ - MOUSE_BUTTONS(170); + MOUSE_BUTTONS(170), + + /** + * Zalcano's form + * -1 : Player is outside or Zalcano is dead i.e. there's no healthbar to show + * Anything else : The {@link NpcID} of the current form + */ + ZALCANO_FORM(1683); private final int id; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPanel.java new file mode 100644 index 0000000000..b30b29ca7e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPanel.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020, dekvall + * 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 HOLDER 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.zalcano; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import javax.inject.Inject; +import net.runelite.client.ui.overlay.OverlayPanel; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.components.LineComponent; + +class ZalcanoPanel extends OverlayPanel +{ + private final ZalcanoPlugin plugin; + + @Inject + public ZalcanoPanel(ZalcanoPlugin plugin) + { + super(plugin); + setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); + this.plugin = plugin; + } + + @Override + public Dimension render(Graphics2D g) + { + if (!plugin.isInCavern()) + { + return null; + } + + panelComponent.getChildren().add(LineComponent.builder() + .left("Health damage:") + .leftColor(colorFromCount(plugin.getHealthDamage())) + .right(Integer.toString(plugin.getHealthDamage())) + .build()); + + panelComponent.getChildren().add(LineComponent.builder() + .left("Shield damage:") + .leftColor(colorFromCount(plugin.getShieldDamage())) + .right(Integer.toString(plugin.getShieldDamage())) + .build()); + + return super.render(g); + } + + private static Color colorFromCount(int damage) + { + if (damage >= 50) + { + // Eligible for uniques/pet + return Color.GREEN; + } + if (damage >= 30) + { + // Eligible for drops + return Color.YELLOW; + } + return Color.RED; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java index b1a606156c..fdaa151b29 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java @@ -28,26 +28,32 @@ import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import lombok.Getter; +import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; import static net.runelite.api.GraphicID.GRAPHICS_OBJECT_ROCKFALL; import net.runelite.api.GraphicsObject; +import net.runelite.api.Hitsplat; import net.runelite.api.NPC; import net.runelite.api.NpcID; import static net.runelite.api.NpcID.ZALCANO; import net.runelite.api.ObjectID; import net.runelite.api.Projectile; import static net.runelite.api.ProjectileID.ZALCANO_PROJECTILE_FIREBALL; +import net.runelite.api.VarPlayer; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GraphicsObjectCreated; +import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.NpcChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.ProjectileMoved; +import net.runelite.api.events.VarbitChanged; +import net.runelite.client.callback.ClientThread; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -72,6 +78,12 @@ public class ZalcanoPlugin extends Plugin @Inject private ZalcanoOverlay overlay; + @Inject + private ZalcanoPanel panel; + + @Inject + private ClientThread clientThread; + @Getter private LocalPoint targetedGlowingRock; @Getter @@ -81,17 +93,35 @@ public class ZalcanoPlugin extends Plugin @Getter private final List rocks = new ArrayList<>(); + @Getter + private int healthDamage; + @Getter + private int shieldDamage; + @Getter + private boolean inCavern; + @Override protected void startUp() { overlayManager.add(overlay); + overlayManager.add(panel); rocks.clear(); + + resetDamageCounter(); + clientThread.invokeLater(() -> + { + if (client.getGameState() == GameState.LOGGED_IN) + { + inCavern = isHealthbarActive(); + } + }); } @Override protected void shutDown() { overlayManager.remove(overlay); + overlayManager.remove(panel); } @Subscribe @@ -107,12 +137,25 @@ public class ZalcanoPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() != GameState.LOGGED_IN) + GameState gameState = event.getGameState(); + if (gameState == GameState.LOADING) { rocks.clear(); } } + @Subscribe + public void onVarbitChanged(VarbitChanged event) + { + boolean wasInCavern = inCavern; + inCavern = isHealthbarActive(); + + if (!inCavern && wasInCavern) + { + resetDamageCounter(); + } + } + @Subscribe public void onNpcSpawned(NpcSpawned event) { @@ -142,6 +185,12 @@ public class ZalcanoPlugin extends Plugin } } + private void resetDamageCounter() + { + healthDamage = 0; + shieldDamage = 0; + } + @Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { @@ -183,4 +232,39 @@ public class ZalcanoPlugin extends Plugin targetedGlowingRockEndCycle = projectile.getEndCycle(); } } + + @Subscribe + public void onHitsplatApplied(HitsplatApplied event) + { + final Actor actor = event.getActor(); + + if (!(actor instanceof NPC)) + { + return; + } + + int npcId = ((NPC) actor).getId(); + if (!(npcId == ZALCANO_WEAKENED || npcId == ZALCANO)) + { + return; + } + + Hitsplat hitsplat = event.getHitsplat(); + int damage = hitsplat.getAmount(); + + switch (hitsplat.getHitsplatType()) + { + case DAMAGE_ME: + healthDamage += damage; + break; + case DAMAGE_ME_ORANGE: + shieldDamage += damage; + break; + } + } + + private boolean isHealthbarActive() + { + return client.getVar(VarPlayer.ZALCANO_FORM) != -1; + } } From 78e0cf53926a9060a559769bd3e40eab16582d22 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Dec 2020 10:43:33 -0500 Subject: [PATCH 086/173] ci: use mvn verify phase instead of install Installing the artifacts is not necessary, and currently we have to remove them from the build cache to prevent that from growing too large --- .github/workflows/CI.yml | 3 --- ci/build.sh | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5cdd4871c2..a117224e5f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -27,6 +27,3 @@ jobs: - name: Build run: ./ci/build.sh - - - name: Remove build artifacts - run: rm -rf ~/.m2/repository/net/runelite diff --git a/ci/build.sh b/ci/build.sh index 4fddc5fa14..a809269824 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -15,4 +15,4 @@ if [ ! -f "${GLSLANG_ARCHIVE}" ] || [ ! -d "${GLSLANG_DIR}" ] || ! echo "${GLSLA unzip -o -q "${GLSLANG_ARCHIVE}" -d "${GLSLANG_DIR}" fi -mvn clean install --settings ci/settings.xml -Dglslang.path="${GLSLANG_DIR}/bin/glslangValidator" +mvn verify --settings ci/settings.xml -Dglslang.path="${GLSLANG_DIR}/bin/glslangValidator" From 38b3d3a9044ba3d2ec2ba7c6690301cced00c982 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Dec 2020 20:42:32 -0500 Subject: [PATCH 087/173] api: remove getViewportWidget() The returned widget isn't actually the viewport widget, but is a layer within the viewport, and only needs to be used within the overlay renderer to position the snapcorners --- .../main/java/net/runelite/api/Client.java | 10 -------- .../blastmine/BlastMineRockOverlay.java | 5 +--- .../grounditems/GroundItemsOverlay.java | 2 +- .../tithefarm/TitheFarmPlantOverlay.java | 5 +--- .../client/ui/overlay/OverlayRenderer.java | 23 ++++++++++++++++--- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 2fc2be3edc..0dcad51c06 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -879,16 +879,6 @@ public interface Client extends GameEngine */ IterableHashTable getMessages(); - /** - * Gets the viewport widget. - *

    - * The viewport is the area of the game above the chatbox - * and to the left of the mini-map. - * - * @return the viewport widget - */ - Widget getViewportWidget(); - /** * Gets the object composition corresponding to an objects ID. * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java index 92fbdfe221..316ffec8c0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java @@ -42,7 +42,6 @@ import net.runelite.api.Point; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -91,12 +90,10 @@ public class BlastMineRockOverlay extends Overlay } final Tile[][][] tiles = client.getScene().getTiles(); - final Widget viewport = client.getViewportWidget(); for (final BlastMineRock rock : rocks.values()) { - if (viewport == null || - rock.getGameObject().getCanvasLocation() == null || + if (rock.getGameObject().getCanvasLocation() == null || rock.getGameObject().getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()) > MAX_DISTANCE) { continue; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index ec1d0527c2..dbd1db7ddd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -111,7 +111,7 @@ public class GroundItemsOverlay extends Overlay final FontMetrics fm = graphics.getFontMetrics(); final Player player = client.getLocalPlayer(); - if (player == null || client.getViewportWidget() == null) + if (player == null) { return null; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java index 5e39d3b452..288893d466 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java @@ -34,7 +34,6 @@ import net.runelite.api.Client; import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; @@ -85,8 +84,6 @@ public class TitheFarmPlantOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - final Widget viewport = client.getViewportWidget(); - for (TitheFarmPlant plant : plugin.getPlants()) { if (plant.getState() == TitheFarmPlantState.DEAD) @@ -103,7 +100,7 @@ public class TitheFarmPlantOverlay extends Overlay final Point canvasLocation = Perspective.localToCanvas(client, localLocation, client.getPlane()); - if (viewport != null && canvasLocation != null) + if (canvasLocation != null) { final ProgressPieComponent progressPieComponent = new ProgressPieComponent(); progressPieComponent.setPosition(canvasLocation); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 6b6c01add2..064fc31fa2 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -48,6 +48,7 @@ import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.KeyCode; import net.runelite.api.MenuEntry; +import net.runelite.api.Varbits; import net.runelite.api.events.BeforeRender; import net.runelite.api.events.ClientTick; import net.runelite.api.events.FocusChanged; @@ -184,7 +185,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener || overlays.isEmpty() || client.getGameState() != GameState.LOGGED_IN || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || client.getViewportWidget() == null) + || getViewportLayer() == null) { return; } @@ -795,11 +796,11 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener changed = true; } - final boolean viewportChanged = !client.getViewportWidget().getBounds().equals(viewportBounds); + final boolean viewportChanged = !getViewportLayer().getBounds().equals(viewportBounds); if (viewportChanged) { - viewportBounds = client.getViewportWidget().getBounds(); + viewportBounds = getViewportLayer().getBounds(); changed = true; } @@ -814,6 +815,22 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener return changed; } + private Widget getViewportLayer() + { + if (client.isResized()) + { + if (client.getVar(Varbits.SIDE_PANELS) == 1) + { + return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE); + } + else + { + return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX); + } + } + return client.getWidget(WidgetInfo.FIXED_VIEWPORT); + } + private OverlayBounds buildSnapCorners() { final Point topLeftPoint = new Point( From 61a36f106f46af8a427c5eb8f9b7aad81561a99f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Dec 2020 20:49:48 -0500 Subject: [PATCH 088/173] overlay renderer: use viewport bounds for snap corner offsets The rendered x/y position of the viewport layer is the same as the viewport offsets. This also no longer assumes the x/y offets are the same, even though in practice they always are. --- .../client/ui/overlay/OverlayRenderer.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 064fc31fa2..7ac97fe42a 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -99,7 +99,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener // Overlay state validation private Rectangle viewportBounds; private Rectangle chatboxBounds; - private int viewportOffset; private boolean chatboxHidden; private boolean isResizeable; private OverlayBounds snapCorners; @@ -804,14 +803,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener changed = true; } - final boolean viewportOffsetChanged = client.getViewportXOffset() != viewportOffset; - - if (viewportOffsetChanged) - { - viewportOffset = client.getViewportXOffset(); - changed = true; - } - return changed; } @@ -834,21 +825,21 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener private OverlayBounds buildSnapCorners() { final Point topLeftPoint = new Point( - viewportOffset + BORDER, - viewportOffset + BORDER_TOP); + viewportBounds.x + BORDER, + viewportBounds.y + BORDER_TOP); final Point topCenterPoint = new Point( - viewportOffset + viewportBounds.width / 2, - viewportOffset + BORDER + viewportBounds.x + viewportBounds.width / 2, + viewportBounds.y + BORDER ); final Point topRightPoint = new Point( - viewportOffset + viewportBounds.width - BORDER, + viewportBounds.x + viewportBounds.width - BORDER, topCenterPoint.y); final Point bottomLeftPoint = new Point( topLeftPoint.x, - viewportOffset + viewportBounds.height - BORDER); + viewportBounds.y + viewportBounds.height - BORDER); final Point bottomRightPoint = new Point( topRightPoint.x, @@ -861,7 +852,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } final Point rightChatboxPoint = isResizeable ? new Point( - viewportOffset + chatboxBounds.width - BORDER, + viewportBounds.x + chatboxBounds.width - BORDER, bottomLeftPoint.y) : bottomRightPoint; final Point canvasTopRightPoint = isResizeable ? new Point( From a43a344aca37fce1668f7a4a8fb292bbe6f9492c Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Dec 2020 20:53:22 -0500 Subject: [PATCH 089/173] Rename various itemWidget to widgetItem to match class name --- .../src/main/java/net/runelite/client/callback/Hooks.java | 4 ++-- .../client/plugins/inventorytags/InventoryTagsOverlay.java | 6 +++--- .../client/plugins/itemcharges/ItemChargeOverlay.java | 4 ++-- .../itemidentification/ItemIdentificationOverlay.java | 4 ++-- .../runelite/client/plugins/runepouch/RunepouchOverlay.java | 6 +++--- .../net/runelite/client/plugins/slayer/SlayerOverlay.java | 4 ++-- .../java/net/runelite/client/ui/overlay/OverlayManager.java | 2 +- .../net/runelite/client/ui/overlay/WidgetItemOverlay.java | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index d7e353df4c..6c725bab94 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -465,7 +465,7 @@ public class Hooks implements Callbacks // WidgetItemOverlays render at ABOVE_WIDGETS, reset widget item // list for next frame. - overlayManager.getItemWidgets().clear(); + overlayManager.getWidgetItems().clear(); } @Subscribe @@ -510,7 +510,7 @@ public class Hooks implements Callbacks // Empty bank item if (widgetItem.getId() != NullItemID.NULL_6512) { - overlayManager.getItemWidgets().add(widgetItem); + overlayManager.getWidgetItems().add(widgetItem); } } 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 c6fafc9466..03857e185c 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 @@ -51,7 +51,7 @@ public class InventoryTagsOverlay extends WidgetItemOverlay } @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem) { final String group = plugin.getTag(itemId); if (group != null) @@ -60,10 +60,10 @@ public class InventoryTagsOverlay extends WidgetItemOverlay final DisplayMode displayMode = config.getDisplayMode(); if (color != null) { - Rectangle bounds = itemWidget.getCanvasBounds(); + Rectangle bounds = widgetItem.getCanvasBounds(); if (displayMode == DisplayMode.OUTLINE) { - final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color); + final BufferedImage outline = itemManager.getItemOutline(itemId, widgetItem.getQuantity(), color); graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null); } else diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java index fc91487230..07e213d1d2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java @@ -52,7 +52,7 @@ class ItemChargeOverlay extends WidgetItemOverlay } @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem) { if (!displayOverlay()) { @@ -153,7 +153,7 @@ class ItemChargeOverlay extends WidgetItemOverlay charges = chargeItem.getCharges(); } - final Rectangle bounds = itemWidget.getCanvasBounds(); + final Rectangle bounds = widgetItem.getCanvasBounds(); final TextComponent textComponent = new TextComponent(); textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15)); textComponent.setText(charges < 0 ? "?" : String.valueOf(charges)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java index 8d332ac837..eaf7824ff6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java @@ -55,7 +55,7 @@ class ItemIdentificationOverlay extends WidgetItemOverlay } @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem) { ItemIdentification iden = findItemIdentification(itemId); if (iden == null) @@ -116,7 +116,7 @@ class ItemIdentificationOverlay extends WidgetItemOverlay } graphics.setFont(FontManager.getRunescapeSmallFont()); - renderText(graphics, itemWidget.getCanvasBounds(), iden); + renderText(graphics, widgetItem.getCanvasBounds(), iden); } private void renderText(Graphics2D graphics, Rectangle bounds, ItemIdentification iden) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java index 8b8131cb7d..255f3f9ac1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java @@ -74,7 +74,7 @@ public class RunepouchOverlay extends WidgetItemOverlay } @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem) { if (itemId != ItemID.RUNE_POUCH && itemId != ItemID.RUNE_POUCH_L) { @@ -85,7 +85,7 @@ public class RunepouchOverlay extends WidgetItemOverlay graphics.setFont(FontManager.getRunescapeSmallFont()); - Point location = itemWidget.getCanvasLocation(); + Point location = widgetItem.getCanvasLocation(); StringBuilder tooltipBuilder = new StringBuilder(); for (int i = 0; i < AMOUNT_VARBITS.length; i++) @@ -142,7 +142,7 @@ public class RunepouchOverlay extends WidgetItemOverlay String tooltip = tooltipBuilder.toString(); if (!tooltip.isEmpty() - && itemWidget.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()) + && widgetItem.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()) && (config.runePouchOverlayMode() == MOUSE_HOVER || config.runePouchOverlayMode() == BOTH)) { tooltipManager.add(new Tooltip(tooltip)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java index 4d70d82f53..6e5ecd72eb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java @@ -94,7 +94,7 @@ class SlayerOverlay extends WidgetItemOverlay } @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem) { if (!ALL_SLAYER_ITEMS.contains(itemId)) { @@ -117,7 +117,7 @@ class SlayerOverlay extends WidgetItemOverlay graphics.setFont(FontManager.getRunescapeSmallFont()); - final Rectangle bounds = itemWidget.getCanvasBounds(); + final Rectangle bounds = widgetItem.getCanvasBounds(); final TextComponent textComponent = new TextComponent(); switch (itemId) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java index b64f845695..9bc2b57769 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java @@ -98,7 +98,7 @@ public class OverlayManager @Getter(AccessLevel.PACKAGE) private final List overlays = new ArrayList<>(); @Getter - private final List itemWidgets = new ArrayList<>(); + private final List widgetItems = new ArrayList<>(); private final Map> overlayLayers = new EnumMap<>(OverlayLayer.class); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java index 295c1d618b..5d1e404575 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java @@ -69,15 +69,15 @@ public abstract class WidgetItemOverlay extends Overlay super.setLayer(OverlayLayer.ABOVE_WIDGETS); } - public abstract void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget); + public abstract void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem); @Override public Dimension render(Graphics2D graphics) { - final List itemWidgets = overlayManager.getItemWidgets(); + final List widgetItems = overlayManager.getWidgetItems(); final Rectangle originalClipBounds = graphics.getClipBounds(); Widget curClipParent = null; - for (WidgetItem widgetItem : itemWidgets) + for (WidgetItem widgetItem : widgetItems) { Widget widget = widgetItem.getWidget(); int interfaceGroup = TO_GROUP(widget.getId()); From 34e37dcc575e4f867c4d99a2b5c00ce1bffabdc1 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Dec 2020 21:01:46 -0500 Subject: [PATCH 090/173] Add interface and layer draw hooks for overlays This allows overlays to request draw after any interface or layer. This allows removal of the ABOVE_MAP layer which can now just be replaced with requesting draw after the map interface. This also fixes item overlays from drawing over top of the map by now drawing the item overlay immediately after the interface and/or layer the item is on is drawn. For backwards compatability, ABOVE_WIDGETS is kept as a layer, but internally just requests draw after the 3 TLIs. Due to overlays defaulting to the UNDER_WIDGETS layer, a new layer MANUAL has been added, which is intended for use when requesting draw after specific interfaces or layers, so that the overlay is otherwise not drawn a second time due to being UNDER_WIDGETS. --- .../net/runelite/api/hooks/Callbacks.java | 17 +++- .../net/runelite/client/callback/Hooks.java | 63 +++++++-------- .../devtools/WidgetInspectorOverlay.java | 2 + .../devtools/WorldMapLocationOverlay.java | 4 +- .../devtools/WorldMapRegionOverlay.java | 4 +- .../ScreenMarkerCreationOverlay.java | 2 +- .../runelite/client/ui/overlay/Overlay.java | 12 +++ .../client/ui/overlay/OverlayLayer.java | 11 +-- .../client/ui/overlay/OverlayManager.java | 78 +++++++++++++------ .../client/ui/overlay/OverlayRenderer.java | 65 ++++++++++------ .../client/ui/overlay/WidgetItemOverlay.java | 39 +++------- .../client/ui/overlay/WidgetOverlay.java | 2 + .../ui/overlay/tooltip/TooltipOverlay.java | 5 +- .../ui/overlay/worldmap/WorldMapOverlay.java | 4 +- 14 files changed, 186 insertions(+), 122 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/hooks/Callbacks.java b/runelite-api/src/main/java/net/runelite/api/hooks/Callbacks.java index 07d00487bc..c03adf5d09 100644 --- a/runelite-api/src/main/java/net/runelite/api/hooks/Callbacks.java +++ b/runelite-api/src/main/java/net/runelite/api/hooks/Callbacks.java @@ -28,7 +28,9 @@ import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; +import java.util.List; import net.runelite.api.MainBufferProvider; +import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetItem; /** @@ -70,8 +72,6 @@ public interface Callbacks */ void drawAboveOverheads(); - void drawAfterWidgets(); - /** * Client top-most draw method, rendering over top of most of game interfaces. * @@ -83,9 +83,18 @@ public interface Callbacks void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y); /** - * Called before the client will render an item widget. + * Called after an interface has been drawn + * @param interfaceId the interface id + * @param widgetItems Widget items within the interface */ - void drawItem(int itemId, WidgetItem widgetItem); + void drawInterface(int interfaceId, List widgetItems); + + /** + * Called after a widget layer has been drawn + * @param layer The layer + * @param widgetItems Widget items within the layer + */ + void drawLayer(Widget layer, List widgetItems); /** * Mouse pressed event. If this event will be consumed it will not be propagated further to client. diff --git a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java index 6c725bab94..dd16869ee5 100644 --- a/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java +++ b/runelite-client/src/main/java/net/runelite/client/callback/Hooks.java @@ -36,12 +36,12 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.image.BufferedImage; import java.awt.image.VolatileImage; +import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.MainBufferProvider; -import net.runelite.api.NullItemID; import net.runelite.api.RenderOverview; import net.runelite.api.Skill; import net.runelite.api.WorldMapManager; @@ -64,7 +64,6 @@ import net.runelite.client.task.Scheduler; import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.DrawManager; import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayRenderer; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.DeferredEventBus; @@ -90,9 +89,6 @@ public class Hooks implements Callbacks @Inject private OverlayRenderer renderer; - @Inject - private OverlayManager overlayManager; - @Inject private EventBus eventBus; @@ -328,7 +324,7 @@ public class Hooks implements Callbacks try { - renderer.render(graphics2d, OverlayLayer.ALWAYS_ON_TOP); + renderer.renderOverlayLayer(graphics2d, OverlayLayer.ALWAYS_ON_TOP); } catch (Exception ex) { @@ -423,7 +419,7 @@ public class Hooks implements Callbacks try { - renderer.render(graphics2d, OverlayLayer.ABOVE_SCENE); + renderer.renderOverlayLayer(graphics2d, OverlayLayer.ABOVE_SCENE); } catch (Exception ex) { @@ -439,7 +435,7 @@ public class Hooks implements Callbacks try { - renderer.render(graphics2d, OverlayLayer.UNDER_WIDGETS); + renderer.renderOverlayLayer(graphics2d, OverlayLayer.UNDER_WIDGETS); } catch (Exception ex) { @@ -447,27 +443,6 @@ public class Hooks implements Callbacks } } - @Override - public void drawAfterWidgets() - { - MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider(); - Graphics2D graphics2d = getGraphics(bufferProvider); - - try - { - renderer.render(graphics2d, OverlayLayer.ABOVE_MAP); - renderer.render(graphics2d, OverlayLayer.ABOVE_WIDGETS); - } - catch (Exception ex) - { - log.warn("Error during overlay rendering", ex); - } - - // WidgetItemOverlays render at ABOVE_WIDGETS, reset widget item - // list for next frame. - overlayManager.getWidgetItems().clear(); - } - @Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { @@ -505,12 +480,34 @@ public class Hooks implements Callbacks } @Override - public void drawItem(int itemId, WidgetItem widgetItem) + public void drawInterface(int interfaceId, List widgetItems) { - // Empty bank item - if (widgetItem.getId() != NullItemID.NULL_6512) + MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider(); + Graphics2D graphics2d = getGraphics(bufferProvider); + + try { - overlayManager.getWidgetItems().add(widgetItem); + renderer.renderAfterInterface(graphics2d, interfaceId, widgetItems); + } + catch (Exception ex) + { + log.warn("Error during overlay rendering", ex); + } + } + + @Override + public void drawLayer(Widget layer, List widgetItems) + { + MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider(); + Graphics2D graphics2d = getGraphics(bufferProvider); + + try + { + renderer.renderAfterLayer(graphics2d, layer, widgetItems); + } + catch (Exception ex) + { + log.warn("Error during overlay rendering", ex); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java index c0ceab94a8..27b83f0f2a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java @@ -37,6 +37,7 @@ import javax.inject.Singleton; import net.runelite.api.Client; import net.runelite.api.MenuEntry; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetItem; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -61,6 +62,7 @@ public class WidgetInspectorOverlay extends Overlay setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_WIDGETS); setPriority(OverlayPriority.HIGHEST); + drawAfterInterface(WidgetID.FULLSCREEN_MAP_GROUP_ID); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java index c0ee198533..fbeedbedfe 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java @@ -35,6 +35,7 @@ import net.runelite.api.Point; import net.runelite.api.RenderOverview; import net.runelite.api.coords.WorldPoint; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -56,7 +57,8 @@ public class WorldMapLocationOverlay extends Overlay this.plugin = plugin; setPosition(OverlayPosition.DYNAMIC); setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ABOVE_MAP); + setLayer(OverlayLayer.MANUAL); + drawAfterInterface(WidgetID.WORLD_MAP_GROUP_ID); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java index 1e136267b8..8bfbf54398 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java @@ -35,6 +35,7 @@ import net.runelite.api.Client; import net.runelite.api.Point; import net.runelite.api.RenderOverview; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -56,7 +57,8 @@ class WorldMapRegionOverlay extends Overlay { setPosition(OverlayPosition.DYNAMIC); setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_MAP); + setLayer(OverlayLayer.MANUAL); + drawAfterInterface(WidgetID.WORLD_MAP_GROUP_ID); this.client = client; this.plugin = plugin; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java index ed60dd119a..98b2c9a73b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java @@ -43,7 +43,7 @@ class ScreenMarkerCreationOverlay extends Overlay { this.plugin = plugin; setPosition(OverlayPosition.DETACHED); - setLayer(OverlayLayer.ALWAYS_ON_TOP); + setLayer(OverlayLayer.ABOVE_WIDGETS); setPriority(OverlayPriority.HIGH); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java index 405fe28080..151c5eae97 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java @@ -33,6 +33,7 @@ import javax.annotation.Nullable; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.plugins.Plugin; import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity; @@ -49,6 +50,7 @@ public abstract class Overlay implements LayoutableRenderableEntity private OverlayPosition position = OverlayPosition.TOP_LEFT; private OverlayPriority priority = OverlayPriority.NONE; private OverlayLayer layer = OverlayLayer.UNDER_WIDGETS; + private final List drawHooks = new ArrayList<>(); private final List menuEntries = new ArrayList<>(); private boolean resizable; private int minimumSize = 32; @@ -81,6 +83,16 @@ public abstract class Overlay implements LayoutableRenderableEntity return this.getClass().getSimpleName(); } + protected void drawAfterInterface(int interfaceId) + { + drawHooks.add(interfaceId << 16 | 0xffff); + } + + protected void drawAfterLayer(WidgetInfo layer) + { + drawHooks.add(layer.getId()); + } + public void onMouseOver() { } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayLayer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayLayer.java index ac75932ad6..35b72220f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayLayer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayLayer.java @@ -26,6 +26,12 @@ package net.runelite.client.ui.overlay; public enum OverlayLayer { + /** + * Overlay is not rendered. Requires using drawAfterInterface() or drawAfterLayer() + * to specify when to draw. + */ + MANUAL, + /** * Render right above the scene (that contains actors and the surface) */ @@ -45,9 +51,4 @@ public enum OverlayLayer * Render overlay above all game elements */ ALWAYS_ON_TOP, - - /** - * Render over the map, even when it's fullscreen - */ - ABOVE_MAP, } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java index 9bc2b57769..6e3c770b37 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java @@ -25,21 +25,24 @@ package net.runelite.client.ui.overlay; import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.MoreObjects; +import com.google.common.collect.ArrayListMultimap; import java.awt.Dimension; import java.awt.Point; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.EnumMap; import java.util.List; -import java.util.Map; import java.util.function.Predicate; import javax.inject.Inject; import javax.inject.Singleton; import lombok.AccessLevel; import lombok.Getter; +import lombok.Setter; import net.runelite.api.MenuAction; import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetItem; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigManager; @@ -66,13 +69,8 @@ public class OverlayManager @VisibleForTesting static final Comparator OVERLAY_COMPARATOR = (a, b) -> { - final OverlayPosition aPos = a.getPreferredPosition() != null - ? a.getPreferredPosition() - : a.getPosition(); - - final OverlayPosition bPos = b.getPreferredPosition() != null - ? b.getPreferredPosition() - : b.getPosition(); + final OverlayPosition aPos = MoreObjects.firstNonNull(a.getPreferredPosition(), a.getPosition()); + final OverlayPosition bPos = MoreObjects.firstNonNull(b.getPreferredPosition(), b.getPosition()); if (aPos != bPos) { @@ -84,7 +82,7 @@ public class OverlayManager // For dynamic overlays, higher priority means to // draw *later* so it is on top. // For non-dynamic overlays, higher priority means - // draw *first* so that they are closer to their + // draw *earlier* so that they are closer to their // defined position. return aPos == OverlayPosition.DYNAMIC ? a.getPriority().compareTo(b.getPriority()) @@ -98,9 +96,16 @@ public class OverlayManager @Getter(AccessLevel.PACKAGE) private final List overlays = new ArrayList<>(); @Getter - private final List widgetItems = new ArrayList<>(); + @Setter + private Collection widgetItems = Collections.emptyList(); - private final Map> overlayLayers = new EnumMap<>(OverlayLayer.class); + /** + * Valid keys are: + * OverlayLayer ABOVE_SCENE, UNDER_WIDGETS, and ALWAYS_ON_TOP + * A component id that is a layer + * An interface id << 16 | 0xffff + */ + private ArrayListMultimap overlayMap = ArrayListMultimap.create(); private final ConfigManager configManager; private final EventBus eventBus; @@ -164,9 +169,19 @@ public class OverlayManager * @param layer the layer * @return An immutable list of all of the overlays on that layer */ - synchronized List getLayer(OverlayLayer layer) + Collection getLayer(OverlayLayer layer) { - return overlayLayers.get(layer); + return Collections.unmodifiableCollection(overlayMap.get(layer)); + } + + Collection getForInterface(int interfaceId) + { + return Collections.unmodifiableCollection(overlayMap.get(interfaceId << 16 | 0xffff)); + } + + Collection getForLayer(int layerId) + { + return Collections.unmodifiableCollection(overlayMap.get(layerId)); } /** @@ -282,11 +297,7 @@ public class OverlayManager synchronized void rebuildOverlayLayers() { - for (OverlayLayer l : OverlayLayer.values()) - { - overlayLayers.put(l, new ArrayList<>()); - } - + ArrayListMultimap overlayMap = ArrayListMultimap.create(); for (final Overlay overlay : overlays) { OverlayLayer layer = overlay.getLayer(); @@ -301,14 +312,33 @@ public class OverlayManager } } - overlayLayers.get(layer).add(overlay); + switch (layer) + { + case ABOVE_SCENE: + case UNDER_WIDGETS: + case ALWAYS_ON_TOP: + overlayMap.put(layer, overlay); + break; + case ABOVE_WIDGETS: + // draw after each of the top level interfaces + overlayMap.put(WidgetID.FIXED_VIEWPORT_GROUP_ID << 16 | 0xffff, overlay); + overlayMap.put(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID << 16 | 0xffff, overlay); + overlayMap.put(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID << 16 | 0xffff, overlay); + break; + } + + for (int drawHook : overlay.getDrawHooks()) + { + overlayMap.put(drawHook, overlay); + } } - overlayLayers.forEach((layer, value) -> + for (Object key : overlayMap.keys()) { - value.sort(OVERLAY_COMPARATOR); - overlayLayers.put(layer, Collections.unmodifiableList(value)); - }); + overlayMap.get(key).sort(OVERLAY_COMPARATOR); + } + + this.overlayMap = overlayMap; } private void loadOverlay(final Overlay overlay) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 7ac97fe42a..e1666d8b14 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -39,6 +39,8 @@ import java.awt.Stroke; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.geom.AffineTransform; +import java.util.Collection; +import java.util.Collections; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; @@ -54,6 +56,7 @@ import net.runelite.api.events.ClientTick; import net.runelite.api.events.FocusChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetItem; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.input.KeyListener; @@ -101,7 +104,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener private Rectangle chatboxBounds; private boolean chatboxHidden; private boolean isResizeable; - private OverlayBounds snapCorners; + private OverlayBounds emptySnapCorners, snapCorners; @Inject private OverlayRenderer( @@ -167,35 +170,51 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener public void onBeforeRender(BeforeRender event) { menuEntries = null; + + if (client.getGameState() == GameState.LOGGED_IN) + { + + if (shouldInvalidateBounds()) + { + emptySnapCorners = buildSnapCorners(); + } + + // Create copy of snap corners because overlays will modify them + snapCorners = new OverlayBounds(emptySnapCorners); + } } - public void render(Graphics2D graphics, final OverlayLayer layer) + public void renderOverlayLayer(Graphics2D graphics, final OverlayLayer layer) { - if (layer != OverlayLayer.ABOVE_MAP - && client.getWidget(WidgetInfo.FULLSCREEN_MAP_ROOT) != null - && !client.getWidget(WidgetInfo.FULLSCREEN_MAP_ROOT).isHidden()) - { - return; - } + final Collection overlays = overlayManager.getLayer(layer); + renderOverlays(graphics, overlays, layer); + } - final List overlays = overlayManager.getLayer(layer); + public void renderAfterInterface(Graphics2D graphics, int interfaceId, Collection widgetItems) + { + Collection overlays = overlayManager.getForInterface(interfaceId); + overlayManager.setWidgetItems(widgetItems); + renderOverlays(graphics, overlays, OverlayLayer.ABOVE_WIDGETS); + overlayManager.setWidgetItems(Collections.emptyList()); + } + public void renderAfterLayer(Graphics2D graphics, Widget layer, Collection widgetItems) + { + Collection overlays = overlayManager.getForLayer(layer.getId()); + overlayManager.setWidgetItems(widgetItems); + renderOverlays(graphics, overlays, OverlayLayer.ABOVE_WIDGETS); + overlayManager.setWidgetItems(Collections.emptyList()); + } + + private void renderOverlays(Graphics2D graphics, Collection overlays, OverlayLayer layer) + { if (overlays == null || overlays.isEmpty() - || client.getGameState() != GameState.LOGGED_IN - || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || getViewportLayer() == null) + || client.getGameState() != GameState.LOGGED_IN) { return; } - if (shouldInvalidateBounds()) - { - snapCorners = buildSnapCorners(); - } - - // Create copy of snap corners because overlays will modify them - OverlayBounds snapCorners = new OverlayBounds(this.snapCorners); OverlayUtil.setGraphicProperties(graphics); // Draw snap corners @@ -629,7 +648,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener // Check if the overlay is over a snapcorner and move it if so, unless it is a detached overlay if (currentManagedOverlay.getPosition() != OverlayPosition.DETACHED && inOverlayDraggingMode) { - final OverlayBounds snapCorners = this.snapCorners.translated(-SNAP_CORNER_SIZE.width, -SNAP_CORNER_SIZE.height); + final OverlayBounds snapCorners = this.emptySnapCorners.translated(-SNAP_CORNER_SIZE.width, -SNAP_CORNER_SIZE.height); for (Rectangle snapCorner : snapCorners.getBounds()) { @@ -795,11 +814,13 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener changed = true; } - final boolean viewportChanged = !getViewportLayer().getBounds().equals(viewportBounds); + Widget viewportWidget = getViewportLayer(); + Rectangle viewport = viewportWidget != null ? viewportWidget.getBounds() : new Rectangle(); + final boolean viewportChanged = !viewport.equals(viewportBounds); if (viewportChanged) { - viewportBounds = getViewportLayer().getBounds(); + viewportBounds = viewport; changed = true; } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java index 5d1e404575..066c52402a 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java @@ -28,45 +28,36 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.Collection; import lombok.AccessLevel; import lombok.Setter; import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.BANK_GROUP_ID; import static net.runelite.api.widgets.WidgetID.BANK_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.DEPOSIT_BOX_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.DUEL_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.DUEL_INVENTORY_OTHER_GROUP_ID; import static net.runelite.api.widgets.WidgetID.EQUIPMENT_GROUP_ID; import static net.runelite.api.widgets.WidgetID.EQUIPMENT_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.GUIDE_PRICES_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID; import static net.runelite.api.widgets.WidgetID.SEED_VAULT_INVENTORY_GROUP_ID; import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.DUEL_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.DUEL_INVENTORY_OTHER_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetInfo.BANK_CONTENT_CONTAINER; -import static net.runelite.api.widgets.WidgetInfo.BANK_TAB_CONTAINER; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetItem; public abstract class WidgetItemOverlay extends Overlay { @Setter(AccessLevel.PACKAGE) private OverlayManager overlayManager; - /** - * Interfaces to draw overlay over. - */ - private final Set interfaceGroups = new HashSet<>(); protected WidgetItemOverlay() { super.setPosition(OverlayPosition.DYNAMIC); super.setPriority(OverlayPriority.LOW); - super.setLayer(OverlayLayer.ABOVE_WIDGETS); + super.setLayer(OverlayLayer.MANUAL); } public abstract void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem widgetItem); @@ -74,22 +65,12 @@ public abstract class WidgetItemOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - final List widgetItems = overlayManager.getWidgetItems(); + final Collection widgetItems = overlayManager.getWidgetItems(); final Rectangle originalClipBounds = graphics.getClipBounds(); Widget curClipParent = null; for (WidgetItem widgetItem : widgetItems) { Widget widget = widgetItem.getWidget(); - int interfaceGroup = TO_GROUP(widget.getId()); - - // Don't draw if this widget isn't one of the allowed nor in tag tab/item tab - if (!interfaceGroups.contains(interfaceGroup) || - (interfaceGroup == BANK_GROUP_ID - && (widget.getParentId() == BANK_CONTENT_CONTAINER.getId() || widget.getParentId() == BANK_TAB_CONTAINER.getId()))) - { - continue; - } - Widget parent = widget.getParent(); Rectangle parentBounds = parent.getBounds(); Rectangle itemCanvasBounds = widgetItem.getCanvasBounds(); @@ -151,7 +132,7 @@ public abstract class WidgetItemOverlay extends Overlay protected void showOnBank() { - showOnInterfaces(BANK_GROUP_ID); + drawAfterLayer(WidgetInfo.BANK_ITEM_CONTAINER); } protected void showOnEquipment() @@ -161,7 +142,7 @@ public abstract class WidgetItemOverlay extends Overlay protected void showOnInterfaces(int... ids) { - Arrays.stream(ids).forEach(interfaceGroups::add); + Arrays.stream(ids).forEach(this::drawAfterInterface); } // Don't allow setting position, priority, or layer diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index d5f57d6590..c1c1028375 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -80,6 +80,8 @@ public class WidgetOverlay extends Overlay setPriority(OverlayPriority.HIGHEST); setLayer(OverlayLayer.UNDER_WIDGETS); setPosition(overlayPosition); + // It's almost possible to drawAfterInterface(widgetInfo.getGroupId()) here, but that fires + // *after* the native components are drawn, which is too late. } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java index 1f68a348f4..002af12c34 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java @@ -32,6 +32,7 @@ import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import net.runelite.api.Client; +import net.runelite.api.widgets.WidgetID; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.TooltipPositionType; import net.runelite.client.ui.overlay.Overlay; @@ -59,7 +60,9 @@ public class TooltipOverlay extends Overlay this.runeLiteConfig = runeLiteConfig; setPosition(OverlayPosition.TOOLTIP); setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); + setLayer(OverlayLayer.ABOVE_WIDGETS); + // additionally allow tooltips above the world map + drawAfterInterface(WidgetID.WORLD_MAP_GROUP_ID); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlay.java index 7e301c8e61..8b2fc1d187 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlay.java @@ -39,6 +39,7 @@ import net.runelite.api.Point; import net.runelite.api.RenderOverview; import net.runelite.api.coords.WorldPoint; import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.input.MouseManager; import net.runelite.client.ui.FontManager; @@ -73,7 +74,8 @@ public class WorldMapOverlay extends Overlay this.worldMapPointManager = worldMapPointManager; setPosition(OverlayPosition.DYNAMIC); setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ABOVE_MAP); + setLayer(OverlayLayer.MANUAL); + drawAfterInterface(WidgetID.WORLD_MAP_GROUP_ID); mouseManager.registerMouseListener(worldMapOverlayMouseListener); } From cb8292319647007c708da03644ad2f99a0f65de7 Mon Sep 17 00:00:00 2001 From: Koanga <34242340+Koanga@users.noreply.github.com> Date: Wed, 16 Dec 2020 11:44:24 -0500 Subject: [PATCH 091/173] item prices: fix evalulating large platinum token stack prices --- .../runelite/client/plugins/itemprices/ItemPricesOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index c614665401..887ed04199 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -198,7 +198,7 @@ class ItemPricesOverlay extends Overlay } else if (id == ItemID.PLATINUM_TOKEN) { - return QuantityFormatter.formatNumber(qty * 1000) + " gp"; + return QuantityFormatter.formatNumber(qty * 1000L) + " gp"; } ItemComposition itemDef = itemManager.getItemComposition(id); From 9d3a10f7d66ea59276049a1bab64370c236949fe Mon Sep 17 00:00:00 2001 From: Fjara - Choppe Date: Wed, 16 Dec 2020 11:49:18 -0500 Subject: [PATCH 092/173] agilityshortcut: fix Neitiznot Bridge agility level requirements Only the northeast (to the center island mine) requires 40 agility --- .../java/net/runelite/client/game/AgilityShortcut.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java index d7a50592f6..ad6c5e0925 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -118,10 +118,10 @@ public enum AgilityShortcut GNOME_STRONGHOLD_ROCKS(37, "Rocks", new WorldPoint(2485, 3515, 0), ROCKS_16534, ROCKS_16535), AL_KHARID_MINING_PITCLIFF_SCRAMBLE(38, "Rocks", new WorldPoint(3305, 3315, 0), ROCKS_16549, ROCKS_16550), YANILLE_WALL_GRAPPLE(39, "Grapple Wall", new WorldPoint(2552, 3072, 0), WALL_17047), - NEITIZNOT_BRIDGE_REPAIR(40, "Bridge Repair - Quest", new WorldPoint(2315, 3828, 0), ROPE_BRIDGE_21306, ROPE_BRIDGE_21307), - NEITIZNOT_BRIDGE_SOUTHEAST(40, "Rope Bridge", null, ROPE_BRIDGE_21308, ROPE_BRIDGE_21309), - NEITIZNOT_BRIDGE_NORTHWEST(40, "Rope Bridge", null, ROPE_BRIDGE_21310, ROPE_BRIDGE_21311), - NEITIZNOT_BRIDGE_NORTH(40, "Rope Bridge", null, ROPE_BRIDGE_21312, ROPE_BRIDGE_21313), + NEITIZNOT_BRIDGE_REPAIR(0, "Bridge Repair - Quest", new WorldPoint(2315, 3828, 0), ROPE_BRIDGE_21306, ROPE_BRIDGE_21307), + NEITIZNOT_BRIDGE_SOUTHEAST(0, "Rope Bridge", null, ROPE_BRIDGE_21308, ROPE_BRIDGE_21309), + NEITIZNOT_BRIDGE_NORTHWEST(0, "Rope Bridge", null, ROPE_BRIDGE_21310, ROPE_BRIDGE_21311), + NEITIZNOT_BRIDGE_NORTH(0, "Rope Bridge", null, ROPE_BRIDGE_21312, ROPE_BRIDGE_21313), NEITIZNOT_BRIDGE_NORTHEAST(40, "Broken Rope bridge", null, ROPE_BRIDGE_21314, ROPE_BRIDGE_21315), KOUREND_LAKE_JUMP_EAST(40, "Stepping Stones", new WorldPoint(1612, 3570, 0), STEPPING_STONE_29729, STEPPING_STONE_29730), KOUREND_LAKE_JUMP_WEST(40, "Stepping Stones", new WorldPoint(1604, 3572, 0), STEPPING_STONE_29729, STEPPING_STONE_29730), From ecbcd1b9cca25bdccc82b65a7bd63f97667e2f73 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sat, 7 Nov 2020 18:36:15 -0700 Subject: [PATCH 093/173] config/PluginHubPanel: show uninstall ui feedback when in safe mode This normally relies on ExternalPluginsChanged being emitted to rebuild the ui, but that doesn't happen in safe mode --- .../client/plugins/config/PluginHubPanel.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java index aa5dbd5074..978be1b4c5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java @@ -280,6 +280,8 @@ class PluginHubPanel extends PluginPanel return; } } + addrm.setText("Installing"); + addrm.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); externalPluginManager.install(manifest.getInternalName()); }); } @@ -287,14 +289,24 @@ class PluginHubPanel extends PluginPanel { addrm.setText("Remove"); addrm.setBackground(new Color(0xBE2828)); - addrm.addActionListener(l -> externalPluginManager.remove(manifest.getInternalName())); + addrm.addActionListener(l -> + { + addrm.setText("Removing"); + addrm.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); + externalPluginManager.remove(manifest.getInternalName()); + }); } else { assert update; addrm.setText("Update"); addrm.setBackground(new Color(0x1F621F)); - addrm.addActionListener(l -> externalPluginManager.update()); + addrm.addActionListener(l -> + { + addrm.setText("Updating"); + addrm.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); + externalPluginManager.update(); + }); } addrm.setBorder(new LineBorder(addrm.getBackground().darker())); addrm.setFocusPainted(false); @@ -313,7 +325,7 @@ class PluginHubPanel extends PluginPanel .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, 100) .addComponent(help, 0, 24, 24) .addComponent(configure, 0, 24, 24) - .addComponent(addrm, 0, 50, GroupLayout.PREFERRED_SIZE) + .addComponent(addrm, 0, 57, GroupLayout.PREFERRED_SIZE) .addGap(5)))); int lineHeight = description.getFontMetrics(description.getFont()).getHeight(); From 1d5df7b4753cd184562ce2a2c14ab7a6eba048a4 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 18 Dec 2020 16:40:46 -0500 Subject: [PATCH 094/173] wiki: use script post fired event for hiding wiki banner --- .../src/main/java/net/runelite/api/ScriptID.java | 6 ++++++ .../net/runelite/client/plugins/wiki/WikiPlugin.java | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index e5d086ced0..ae32b36b8b 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -320,4 +320,10 @@ public final class ScriptID */ @ScriptArguments(integer = 7) public static final int SETTINGS_SLIDER_CHOOSE_ONOP = 3885; + + /** + * Position and size the wiki button, as well as hide/unhide it + */ + @ScriptArguments(integer = 4) + public static final int WIKI_ICON_UPDATE = 3306; } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 2f0609bcfe..bf7498a25e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -36,11 +36,12 @@ import net.runelite.api.MenuEntry; import net.runelite.api.NPC; import net.runelite.api.NPCComposition; import net.runelite.api.ObjectComposition; +import net.runelite.api.ScriptID; import net.runelite.api.SpriteID; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WidgetHiddenChanged; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; @@ -198,11 +199,12 @@ public class WikiPlugin extends Plugin } @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged ev) + public void onScriptPostFired(ScriptPostFired scriptPostFired) { - if (ev.getWidget().getId() == WidgetInfo.MINIMAP_WIKI_BANNER.getId()) + if (scriptPostFired.getScriptId() == ScriptID.WIKI_ICON_UPDATE) { - ev.getWidget().setHidden(true); + Widget w = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); + w.setHidden(true); } } From eafaaec07d35cab42c6ae394563e3745ac423c8b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 18 Dec 2020 15:53:11 -0500 Subject: [PATCH 095/173] timers: use pvp varbit to clear teleblock timer --- .../client/plugins/timers/TimersPlugin.java | 47 ++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index ec45039942..92d6b87893 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -39,7 +39,6 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.Constants; import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; @@ -51,7 +50,6 @@ import net.runelite.api.NpcID; import net.runelite.api.Player; import net.runelite.api.VarPlayer; import net.runelite.api.Varbits; -import net.runelite.api.WorldType; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ActorDeath; import net.runelite.api.events.AnimationChanged; @@ -64,10 +62,7 @@ import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.NpcChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -135,15 +130,14 @@ public class TimersPlugin extends Plugin private boolean wasWearingEndurance; private int lastRaidVarb; - private int lastWildernessVarb; private int lastVengCooldownVarb; private int lastIsVengeancedVarb; private int lastPoisonVarp; + private int lastPvpVarb; private int nextPoisonTick; private WorldPoint lastPoint; private TeleportWidget lastTeleportClicked; private int lastAnimation; - private boolean loggedInRace; private boolean widgetHiddenChangedOnPvpWorld; private ElapsedTimer tzhaarTimer; @@ -176,7 +170,6 @@ public class TimersPlugin extends Plugin lastPoint = null; lastTeleportClicked = null; lastAnimation = -1; - loggedInRace = false; widgetHiddenChangedOnPvpWorld = false; lastPoisonVarp = 0; nextPoisonTick = 0; @@ -191,6 +184,7 @@ public class TimersPlugin extends Plugin int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN); int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE); int poisonVarp = client.getVar(VarPlayer.POISON); + int pvpVarb = client.getVar(Varbits.PVP_SPEC_ORB); if (lastRaidVarb != raidVarb) { @@ -227,22 +221,6 @@ public class TimersPlugin extends Plugin lastIsVengeancedVarb = isVengeancedVarb; } - int inWilderness = client.getVar(Varbits.IN_WILDERNESS); - - if (lastWildernessVarb != inWilderness - && client.getGameState() == GameState.LOGGED_IN - && !loggedInRace) - { - if (!WorldType.isPvpWorld(client.getWorldType()) - && inWilderness == 0) - { - log.debug("Left wilderness in non-PVP world, clearing Teleblock timer."); - removeGameTimer(TELEBLOCK); - } - - lastWildernessVarb = inWilderness; - } - if (lastPoisonVarp != poisonVarp && config.showAntiPoison()) { final int tickCount = client.getTickCount(); @@ -272,16 +250,16 @@ public class TimersPlugin extends Plugin lastPoisonVarp = poisonVarp; } - } - @Subscribe - public void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - Widget widget = event.getWidget(); - if (WorldType.isPvpWorld(client.getWorldType()) - && WidgetInfo.TO_GROUP(widget.getId()) == WidgetID.PVP_GROUP_ID) + if (lastPvpVarb != pvpVarb) { - widgetHiddenChangedOnPvpWorld = true; + if (pvpVarb == 0) + { + log.debug("Left a PVP zone, clearing teleblock timer"); + removeGameTimer(TELEBLOCK); + } + + lastPvpVarb = pvpVarb; } } @@ -763,8 +741,6 @@ public class TimersPlugin extends Plugin @Subscribe public void onGameTick(GameTick event) { - loggedInRace = false; - Player player = client.getLocalPlayer(); WorldPoint currentWorldPoint = player.getWorldLocation(); @@ -826,9 +802,6 @@ public class TimersPlugin extends Plugin removeTzhaarTimer(); // will be readded by the wave message removeGameTimer(TELEBLOCK); break; - case LOGGED_IN: - loggedInRace = true; - break; } } From 5dc5adc01ff407e0e61b9220c5aae553a7ca8d47 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Dec 2020 13:56:53 -0500 Subject: [PATCH 096/173] Remove ITEM_DROP menu action It is identical to ITEM_FIFTH_OPTION and of() was returning only ITEM_DROP, which made ITEM_FIFTH_OPTION useless --- runelite-api/src/main/java/net/runelite/api/MenuAction.java | 4 ---- .../client/plugins/crowdsourcing/zmi/CrowdsourcingZMI.java | 1 - .../client/plugins/grounditems/GroundItemsPlugin.java | 2 +- .../client/plugins/mousehighlight/MouseHighlightOverlay.java | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/MenuAction.java b/runelite-api/src/main/java/net/runelite/api/MenuAction.java index 8f8033ad8c..e389a3c588 100644 --- a/runelite-api/src/main/java/net/runelite/api/MenuAction.java +++ b/runelite-api/src/main/java/net/runelite/api/MenuAction.java @@ -186,10 +186,6 @@ public enum MenuAction * Fifth menu action for an item. */ ITEM_FIFTH_OPTION(37), - /** - * Menu action to drop an item (identical to ITEM_FIFTH_OPTION). - */ - ITEM_DROP(37), /** * Menu action to use an item. */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/zmi/CrowdsourcingZMI.java b/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/zmi/CrowdsourcingZMI.java index 2f76cd4741..669be22f22 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/zmi/CrowdsourcingZMI.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/zmi/CrowdsourcingZMI.java @@ -90,7 +90,6 @@ public class CrowdsourcingZMI case GROUND_ITEM_THIRD_OPTION: case GROUND_ITEM_FOURTH_OPTION: case GROUND_ITEM_FIFTH_OPTION: - case ITEM_DROP: illegalActionTick = client.getTickCount(); break; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index 4bedc5c28e..0c8db3a0e1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -680,7 +680,7 @@ public class GroundItemsPlugin extends Plugin @Subscribe public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) { - if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_DROP) + if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION) { int itemId = menuOptionClicked.getId(); // Keep a queue of recently dropped items to better detect diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java index 07b11ccf50..be6001241d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java @@ -61,7 +61,6 @@ class MouseHighlightOverlay extends Overlay MenuAction.ITEM_FOURTH_OPTION, MenuAction.ITEM_FIFTH_OPTION, MenuAction.ITEM_USE, - MenuAction.ITEM_DROP, MenuAction.WIDGET_FIRST_OPTION, MenuAction.WIDGET_SECOND_OPTION, MenuAction.WIDGET_THIRD_OPTION, From c05d29424fa251dd91e47445f9533262ff1ff4d8 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Dec 2020 14:01:19 -0500 Subject: [PATCH 097/173] menu entry swapper: replace some client.getItemDefinition calls with itemManager.getItemComposition --- .../plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 fc868c6de4..9f65f2d11a 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 @@ -476,7 +476,7 @@ public class MenuEntrySwapperPlugin extends Plugin return; } - ItemComposition itemComposition = client.getItemDefinition(itemId); + ItemComposition itemComposition = itemManager.getItemComposition(itemId); String itemName = itemComposition.getName(); String option = "Use"; int shiftClickActionIndex = itemComposition.getShiftClickActionIndex(); @@ -597,7 +597,7 @@ public class MenuEntrySwapperPlugin extends Plugin String option = event.getMenuOption(); String target = event.getMenuTarget(); - ItemComposition itemComposition = client.getItemDefinition(itemId); + ItemComposition itemComposition = itemManager.getItemComposition(itemId); if (option.equals(RESET) && target.equals(MENU_TARGET)) { From b1ebf7814b114105e4997678922817109709c1d1 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Dec 2020 14:09:39 -0500 Subject: [PATCH 098/173] menu entry swapper: refactor configure shift click menu code to use menu types and ids This fixes an issue where if the action at the configured shift click action index was null, which can happen due to item variations, the option.equals() check would npe, and prevent configuring shift click on the item. --- .../MenuEntrySwapperPlugin.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) 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 9f65f2d11a..fd60d7eef2 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 @@ -105,6 +105,16 @@ public class MenuEntrySwapperPlugin extends Plugin private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); + private static final Set ITEM_MENU_TYPES = ImmutableSet.of( + MenuAction.ITEM_FIRST_OPTION, + MenuAction.ITEM_SECOND_OPTION, + MenuAction.ITEM_THIRD_OPTION, + MenuAction.ITEM_FOURTH_OPTION, + MenuAction.ITEM_FIFTH_OPTION, + MenuAction.EXAMINE_ITEM, + MenuAction.ITEM_USE + ); + private static final Set NPC_MENU_TYPES = ImmutableSet.of( MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION, @@ -477,27 +487,27 @@ public class MenuEntrySwapperPlugin extends Plugin } ItemComposition itemComposition = itemManager.getItemComposition(itemId); - String itemName = itemComposition.getName(); - String option = "Use"; - int shiftClickActionIndex = itemComposition.getShiftClickActionIndex(); - String[] inventoryActions = itemComposition.getInventoryActions(); + MenuAction shiftClickAction = MenuAction.ITEM_USE; + final int shiftClickActionIndex = itemComposition.getShiftClickActionIndex(); - if (shiftClickActionIndex >= 0 && shiftClickActionIndex < inventoryActions.length) + if (shiftClickActionIndex >= 0) { - option = inventoryActions[shiftClickActionIndex]; + shiftClickAction = MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + shiftClickActionIndex); } MenuEntry[] entries = event.getMenuEntries(); for (MenuEntry entry : entries) { - if (itemName.equals(Text.removeTags(entry.getTarget()))) + final MenuAction menuAction = MenuAction.of(entry.getType()); + + if (ITEM_MENU_TYPES.contains(menuAction) && entry.getIdentifier() == itemId) { entry.setType(MenuAction.RUNELITE.getId()); - if (option.equals(entry.getOption())) + if (shiftClickAction == menuAction) { - entry.setOption("* " + option); + entry.setOption("* " + entry.getOption()); } } } From ab4cf1afe913879f9d0c1b031d77798b0b6c865e Mon Sep 17 00:00:00 2001 From: pilino1234 Date: Mon, 17 Aug 2020 00:27:37 +0200 Subject: [PATCH 099/173] Add alpha channel to color config options where applicable --- .../client/config/RuneLiteConfig.java | 2 +- .../client/plugins/agility/AgilityConfig.java | 7 ++ .../plugins/agility/AgilityOverlay.java | 4 +- .../blastmine/BlastMinePluginConfig.java | 3 + .../blastmine/BlastMineRockOverlay.java | 3 +- .../client/plugins/config/ConfigPanel.java | 24 ++--- .../plugins/driftnet/DriftNetConfig.java | 3 + .../client/plugins/fishing/FishingConfig.java | 4 + .../grounditems/GroundItemsConfig.java | 8 ++ .../plugins/herbiboars/HerbiboarConfig.java | 5 + .../plugins/herbiboars/HerbiboarOverlay.java | 3 +- .../client/plugins/hunter/HunterConfig.java | 5 + .../client/plugins/hunter/TrapOverlay.java | 9 +- .../plugins/implings/ImplingsConfig.java | 14 +++ .../plugins/itemstats/ItemStatConfig.java | 2 +- .../npchighlight/NpcIndicatorsConfig.java | 2 +- .../plugins/npchighlight/NpcSceneOverlay.java | 3 +- .../npcunaggroarea/NpcAggroAreaConfig.java | 4 +- .../pyramidplunder/PyramidPlunderConfig.java | 4 + .../pyramidplunder/PyramidPlunderOverlay.java | 4 +- .../client/plugins/slayer/SlayerConfig.java | 2 + .../plugins/slayer/TargetClickboxOverlay.java | 3 +- .../tithefarm/TitheFarmPlantOverlay.java | 7 +- .../tithefarm/TitheFarmPluginConfig.java | 4 + .../client/ui/components/ColorJButton.java | 93 +++++++++++++++++++ .../components/colorpicker/PreviewPanel.java | 13 ++- .../client/ui/overlay/OverlayUtil.java | 5 +- .../ui/overlay/components/TextComponent.java | 3 +- .../net/runelite/client/util/ColorUtil.java | 18 ++++ .../runelite/client/util/ColorUtilTest.java | 49 +++++++--- 30 files changed, 258 insertions(+), 52 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/components/ColorJButton.java diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java index d68ae06f02..dfa1583135 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java @@ -367,6 +367,7 @@ public interface RuneLiteConfig extends Config return false; } + @Alpha @ConfigItem( keyName = "overlayBackgroundColor", name = "Overlay Color", @@ -374,7 +375,6 @@ public interface RuneLiteConfig extends Config position = 44, section = overlaySettings ) - @Alpha default Color overlayBackgroundColor() { return ComponentConstants.STANDARD_BACKGROUND_COLOR; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java index de9962d678..a5ba1dca42 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.agility; 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; @@ -97,6 +98,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "overlayColor", name = "Overlay Color", @@ -119,6 +121,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "markHighlight", name = "Mark Highlight Color", @@ -141,6 +144,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "portalsHighlight", name = "Portals Highlight Color", @@ -174,6 +178,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "trapHighlight", name = "Trap Overlay Color", @@ -218,6 +223,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "stickHighlightColor", name = "Stick Highlight Color", @@ -241,6 +247,7 @@ public interface AgilityConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "sepulchreHighlightColor", name = "Projectile Color", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java index a7996744c2..6a45b399d4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java @@ -45,6 +45,7 @@ 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.OverlayUtil; +import net.runelite.client.util.ColorUtil; class AgilityOverlay extends Overlay { @@ -131,11 +132,10 @@ class AgilityOverlay extends Overlay } graphics.draw(objectClickbox); - graphics.setColor(new Color(configColor.getRed(), configColor.getGreen(), configColor.getBlue(), 50)); + graphics.setColor(ColorUtil.colorWithAlpha(configColor, configColor.getAlpha() / 5)); graphics.fill(objectClickbox); } } - }); if (config.highlightMarks() && !marksOfGrace.isEmpty()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java index 76848a66e2..20debb84ff 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.blastmine; +import net.runelite.client.config.Alpha; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -77,6 +78,7 @@ public interface BlastMinePluginConfig extends Config return true; } + @Alpha @ConfigItem( position = 4, keyName = "hexTimerColor", @@ -88,6 +90,7 @@ public interface BlastMinePluginConfig extends Config return new Color(217, 54, 0); } + @Alpha @ConfigItem( position = 5, keyName = "hexWarningColor", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java index 316ffec8c0..06e76e69d3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java @@ -47,6 +47,7 @@ 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; public class BlastMineRockOverlay extends Overlay { @@ -199,7 +200,7 @@ public class BlastMineRockOverlay extends Overlay if (poly != null) { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 100)); + graphics.setColor(ColorUtil.colorWithAlpha(color, (int) (color.getAlpha() / 2.5))); graphics.fillPolygon(poly); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index f17d41a2cb..278864ea15 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -89,6 +89,7 @@ import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.DynamicGridLayout; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.PluginPanel; +import net.runelite.client.ui.components.ColorJButton; import net.runelite.client.ui.components.ComboBoxListRenderer; import net.runelite.client.ui.components.colorpicker.ColorPickerManager; import net.runelite.client.ui.components.colorpicker.RuneliteColorPicker; @@ -407,24 +408,23 @@ class ConfigPanel extends PluginPanel if (cid.getType() == Color.class) { - String existing = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName()); + Color existing = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName(), Color.class); - Color existingColor; - JButton colorPickerBtn; + ColorJButton colorPickerBtn; + + boolean alphaHidden = cid.getAlpha() == null; if (existing == null) { - existingColor = Color.BLACK; - colorPickerBtn = new JButton("Pick a color"); + colorPickerBtn = new ColorJButton("Pick a color", Color.BLACK); } else { - existingColor = ColorUtil.fromString(existing); - colorPickerBtn = new JButton(ColorUtil.toHexColor(existingColor).toUpperCase()); + String colorHex = "#" + (alphaHidden ? ColorUtil.colorToHexCode(existing) : ColorUtil.colorToAlphaHexCode(existing)).toUpperCase(); + colorPickerBtn = new ColorJButton(colorHex, existing); } colorPickerBtn.setFocusable(false); - colorPickerBtn.setBackground(existingColor); colorPickerBtn.addMouseListener(new MouseAdapter() { @Override @@ -432,14 +432,14 @@ class ConfigPanel extends PluginPanel { RuneliteColorPicker colorPicker = colorPickerManager.create( SwingUtilities.windowForComponent(ConfigPanel.this), - colorPickerBtn.getBackground(), + colorPickerBtn.getColor(), cid.getItem().name(), - cid.getAlpha() == null); + alphaHidden); colorPicker.setLocation(getLocationOnScreen()); colorPicker.setOnColorChange(c -> { - colorPickerBtn.setBackground(c); - colorPickerBtn.setText(ColorUtil.toHexColor(c).toUpperCase()); + colorPickerBtn.setColor(c); + colorPickerBtn.setText("#" + (alphaHidden ? ColorUtil.colorToHexCode(c) : ColorUtil.colorToAlphaHexCode(c)).toUpperCase()); }); colorPicker.setOnClose(c -> changeConfiguration(colorPicker, cd, cid)); colorPicker.setVisible(true); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java index 5ca1f29194..a977ab3890 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java @@ -26,6 +26,7 @@ package net.runelite.client.plugins.driftnet; 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; @@ -84,6 +85,7 @@ public interface DriftNetConfig extends Config return 60; } + @Alpha @ConfigItem( keyName = "untaggedFishColor", name = "Untagged fish color", @@ -106,6 +108,7 @@ public interface DriftNetConfig extends Config return true; } + @Alpha @ConfigItem( keyName = "annetteTagColor", name = "Annette tag color", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java index 4c9153f42a..e5a1bca65b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.fishing; 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; @@ -77,6 +78,7 @@ public interface FishingConfig extends Config return false; } + @Alpha @ConfigItem( keyName = "overlayColor", name = "Overlay Color", @@ -88,6 +90,7 @@ public interface FishingConfig extends Config return Color.CYAN; } + @Alpha @ConfigItem( keyName = "minnowsOverlayColor", name = "Minnows Overlay Color", @@ -99,6 +102,7 @@ public interface FishingConfig extends Config return Color.RED; } + @Alpha @ConfigItem( keyName = "aerialOverlayColor", name = "Aerial Overlay Color", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java index 43ce88dd2e..6540aa6e80 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java @@ -26,6 +26,7 @@ package net.runelite.client.plugins.grounditems; 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; @@ -219,6 +220,7 @@ public interface GroundItemsConfig extends Config return 0; } + @Alpha @ConfigItem( keyName = "defaultColor", name = "Default items color", @@ -230,6 +232,7 @@ public interface GroundItemsConfig extends Config return Color.WHITE; } + @Alpha @ConfigItem( keyName = "highlightedColor", name = "Highlighted items color", @@ -241,6 +244,7 @@ public interface GroundItemsConfig extends Config return Color.decode("#AA00FF"); } + @Alpha @ConfigItem( keyName = "hiddenColor", name = "Hidden items color", @@ -252,6 +256,7 @@ public interface GroundItemsConfig extends Config return Color.GRAY; } + @Alpha @ConfigItem( keyName = "lowValueColor", name = "Low value items color", @@ -274,6 +279,7 @@ public interface GroundItemsConfig extends Config return 20000; } + @Alpha @ConfigItem( keyName = "mediumValueColor", name = "Medium value items color", @@ -296,6 +302,7 @@ public interface GroundItemsConfig extends Config return 100000; } + @Alpha @ConfigItem( keyName = "highValueColor", name = "High value items color", @@ -318,6 +325,7 @@ public interface GroundItemsConfig extends Config return 1000000; } + @Alpha @ConfigItem( keyName = "insaneValueColor", name = "Insane value items color", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java index 15b27bf79f..42e1c503b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.herbiboars; 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; @@ -54,6 +55,7 @@ public interface HerbiboarConfig extends Config return false; } + @Alpha @ConfigItem( position = 2, keyName = "colorStart", @@ -76,6 +78,7 @@ public interface HerbiboarConfig extends Config return true; } + @Alpha @ConfigItem( position = 4, keyName = "colorTunnel", @@ -98,6 +101,7 @@ public interface HerbiboarConfig extends Config return true; } + @Alpha @ConfigItem( position = 6, keyName = "colorGameObject", @@ -120,6 +124,7 @@ public interface HerbiboarConfig extends Config return true; } + @Alpha @ConfigItem( position = 8, keyName = "colorTrail", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java index 5389cd6fd0..f2e62c3320 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java @@ -37,6 +37,7 @@ 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.OverlayUtil; +import net.runelite.client.util.ColorUtil; class HerbiboarOverlay extends Overlay { @@ -126,7 +127,7 @@ class HerbiboarOverlay extends Overlay Shape clickbox = object.getClickbox(); if (clickbox != null) { - Color clickBoxColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 20); + Color clickBoxColor = ColorUtil.colorWithAlpha(color, color.getAlpha() / 12); graphics.setColor(color); graphics.draw(clickbox); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java index 87df9baadd..66bf54660c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.hunter; 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; @@ -32,6 +33,7 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("hunterplugin") public interface HunterConfig extends Config { + @Alpha @ConfigItem( position = 1, keyName = "hexColorOpenTrap", @@ -43,6 +45,7 @@ public interface HunterConfig extends Config return Color.YELLOW; } + @Alpha @ConfigItem( position = 2, keyName = "hexColorFullTrap", @@ -54,6 +57,7 @@ public interface HunterConfig extends Config return Color.GREEN; } + @Alpha @ConfigItem( position = 3, keyName = "hexColorEmptyTrap", @@ -65,6 +69,7 @@ public interface HunterConfig extends Config return Color.RED; } + @Alpha @ConfigItem( position = 4, keyName = "hexColorTransTrap", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java index 1e0f23b358..d838f6b1ec 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java @@ -37,6 +37,7 @@ 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; /** * Represents the overlay that shows timers on traps that are placed by the @@ -81,13 +82,13 @@ public class TrapOverlay extends Overlay public void updateConfig() { colorEmptyBorder = config.getEmptyTrapColor(); - colorEmpty = new Color(colorEmptyBorder.getRed(), colorEmptyBorder.getGreen(), colorEmptyBorder.getBlue(), 100); + colorEmpty = ColorUtil.colorWithAlpha(colorEmptyBorder, (int)(colorEmptyBorder.getAlpha() / 2.5)); colorFullBorder = config.getFullTrapColor(); - colorFull = new Color(colorFullBorder.getRed(), colorFullBorder.getGreen(), colorFullBorder.getBlue(), 100); + colorFull = ColorUtil.colorWithAlpha(colorFullBorder, (int)(colorFullBorder.getAlpha() / 2.5)); colorOpenBorder = config.getOpenTrapColor(); - colorOpen = new Color(colorOpenBorder.getRed(), colorOpenBorder.getGreen(), colorOpenBorder.getBlue(), 100); + colorOpen = ColorUtil.colorWithAlpha(colorOpenBorder, (int)(colorOpenBorder.getAlpha() / 2.5)); colorTransBorder = config.getTransTrapColor(); - colorTrans = new Color(colorTransBorder.getRed(), colorTransBorder.getGreen(), colorTransBorder.getBlue(), 100); + colorTrans = ColorUtil.colorWithAlpha(colorTransBorder, (int)(colorTransBorder.getAlpha() / 2.5)); } /** diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java index ac88a11214..9fe7e56fb9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.implings; 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; @@ -63,6 +64,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 2, keyName = "babyColor", @@ -87,6 +89,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 4, keyName = "youngColor", @@ -111,6 +114,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 6, keyName = "gourmetColor", @@ -135,6 +139,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 8, keyName = "earthColor", @@ -159,6 +164,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 10, keyName = "essenceColor", @@ -183,6 +189,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 12, keyName = "eclecticColor", @@ -207,6 +214,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 14, keyName = "natureColor", @@ -231,6 +239,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 16, keyName = "magpieColor", @@ -255,6 +264,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 18, keyName = "ninjaColor", @@ -279,6 +289,7 @@ public interface ImplingsConfig extends Config return ImplingMode.NONE; } + @Alpha @ConfigItem( position = 20, keyName = "crystalColor", @@ -303,6 +314,7 @@ public interface ImplingsConfig extends Config return ImplingMode.HIGHLIGHT; } + @Alpha @ConfigItem( position = 22, keyName = "dragonColor", @@ -327,6 +339,7 @@ public interface ImplingsConfig extends Config return ImplingMode.HIGHLIGHT; } + @Alpha @ConfigItem( position = 24, keyName = "luckyColor", @@ -350,6 +363,7 @@ public interface ImplingsConfig extends Config return false; } + @Alpha @ConfigItem( position = 26, keyName = "spawnColor", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java index 5d62df7abb..38d491d40a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java @@ -144,7 +144,6 @@ public interface ItemStatConfig extends Config return new Color(0x9CEE33); } - @ConfigItem( keyName = "colorBetterCapped", name = "Better (Capped)", @@ -155,6 +154,7 @@ public interface ItemStatConfig extends Config { return new Color(0xEEEE33); } + @ConfigItem( keyName = "colorNoChange", name = "No change", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java index 375d919aa5..26e93c6196 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java @@ -95,13 +95,13 @@ public interface NpcIndicatorsConfig extends Config ) void setNpcToHighlight(String npcsToHighlight); + @Alpha @ConfigItem( position = 4, keyName = "npcColor", name = "Highlight Color", description = "Color of the NPC highlight" ) - @Alpha default Color getHighlightColor() { return Color.CYAN; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java index 441d811a97..3fdaeb114a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java @@ -48,6 +48,7 @@ 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.OverlayUtil; +import net.runelite.client.util.ColorUtil; import net.runelite.client.util.Text; public class NpcSceneOverlay extends Overlay @@ -199,7 +200,7 @@ public class NpcSceneOverlay extends Overlay graphics.setColor(color); graphics.setStroke(new BasicStroke(2)); graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); + graphics.setColor(ColorUtil.colorWithAlpha(color, color.getAlpha() / 12)); graphics.fill(polygon); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java index 223695fa64..6fbdbb7e08 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java @@ -83,25 +83,25 @@ public interface NpcAggroAreaConfig extends Config return false; } + @Alpha @ConfigItem( keyName = "npcAggroAreaColor", name = "Aggressive colour", description = "Choose colour to use for marking NPC unaggressive area when NPCs are aggressive", position = 5 ) - @Alpha default Color aggroAreaColor() { return new Color(0x64FFFF00, true); } + @Alpha @ConfigItem( keyName = "npcUnaggroAreaColor", name = "Unaggressive colour", description = "Choose colour to use for marking NPC unaggressive area after NPCs have lost aggression", position = 6 ) - @Alpha default Color unaggroAreaColor() { return new Color(0xFFFF00); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java index 107f7ee4c1..aa145fad74 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.pyramidplunder; 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; @@ -64,6 +65,7 @@ public interface PyramidPlunderConfig extends Config return 30; } + @Alpha @ConfigItem( position = 3, keyName = "highlightDoorsColor", @@ -86,6 +88,7 @@ public interface PyramidPlunderConfig extends Config return true; } + @Alpha @ConfigItem( position = 5, keyName = "highlightSpeartrapColor", @@ -108,6 +111,7 @@ public interface PyramidPlunderConfig extends Config return true; } + @Alpha @ConfigItem( position = 7, keyName = "highlightContainersColor", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java index aee5406f19..6f11cde829 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java @@ -50,6 +50,7 @@ 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.OverlayUtil; +import net.runelite.client.util.ColorUtil; class PyramidPlunderOverlay extends Overlay { @@ -157,8 +158,7 @@ class PyramidPlunderOverlay extends Overlay } graphics.draw(objectClickbox); - graphics.setColor(new Color(highlightColor.getRed(), highlightColor.getGreen(), - highlightColor.getBlue(), 50)); + graphics.setColor(ColorUtil.colorWithAlpha(highlightColor, highlightColor.getAlpha() / 5)); graphics.fill(objectClickbox); } }); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java index 3abe33b392..3dbbf4564c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java @@ -26,6 +26,7 @@ package net.runelite.client.plugins.slayer; 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; @@ -90,6 +91,7 @@ public interface SlayerConfig extends Config return false; } + @Alpha @ConfigItem( position = 6, keyName = "targetColor", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java index 52b5b31865..441f1c6d85 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java @@ -37,6 +37,7 @@ import net.runelite.api.NPC; 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.util.ColorUtil; public class TargetClickboxOverlay extends Overlay { @@ -77,7 +78,7 @@ public class TargetClickboxOverlay extends Overlay graphics.setColor(color); graphics.setStroke(new BasicStroke(2)); graphics.draw(objectClickbox); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); + graphics.setColor(ColorUtil.colorWithAlpha(color, color.getAlpha() / 12)); graphics.fill(objectClickbox); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java index 288893d466..d28ed07bdb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java @@ -38,6 +38,7 @@ 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; public class TitheFarmPlantOverlay extends Overlay { @@ -66,17 +67,17 @@ public class TitheFarmPlantOverlay extends Overlay fills.clear(); final Color colorUnwateredBorder = config.getColorUnwatered(); - final Color colorUnwatered = new Color(colorUnwateredBorder.getRed(), colorUnwateredBorder.getGreen(), colorUnwateredBorder.getBlue(), 100); + final Color colorUnwatered = ColorUtil.colorWithAlpha(colorUnwateredBorder, (int) (colorUnwateredBorder.getAlpha() / 2.5)); borders.put(TitheFarmPlantState.UNWATERED, colorUnwateredBorder); fills.put(TitheFarmPlantState.UNWATERED, colorUnwatered); final Color colorWateredBorder = config.getColorWatered(); - final Color colorWatered = new Color(colorWateredBorder.getRed(), colorWateredBorder.getGreen(), colorWateredBorder.getBlue(), 100); + final Color colorWatered = ColorUtil.colorWithAlpha(colorWateredBorder, (int) (colorWateredBorder.getAlpha() / 2.5)); borders.put(TitheFarmPlantState.WATERED, colorWateredBorder); fills.put(TitheFarmPlantState.WATERED, colorWatered); final Color colorGrownBorder = config.getColorGrown(); - final Color colorGrown = new Color(colorGrownBorder.getRed(), colorGrownBorder.getGreen(), colorGrownBorder.getBlue(), 100); + final Color colorGrown = ColorUtil.colorWithAlpha(colorGrownBorder, (int) (colorGrownBorder.getAlpha() / 2.5)); borders.put(TitheFarmPlantState.GROWN, colorGrownBorder); fills.put(TitheFarmPlantState.GROWN, colorGrown); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java index 007953b618..f9ee9a26d3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.tithefarm; 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; @@ -32,6 +33,7 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("tithefarmplugin") public interface TitheFarmPluginConfig extends Config { + @Alpha @ConfigItem( position = 1, keyName = "hexColorUnwatered", @@ -43,6 +45,7 @@ public interface TitheFarmPluginConfig extends Config return new Color(255, 187, 0); } + @Alpha @ConfigItem( position = 2, keyName = "hexColorWatered", @@ -54,6 +57,7 @@ public interface TitheFarmPluginConfig extends Config return new Color(0, 153, 255); } + @Alpha @ConfigItem( position = 3, keyName = "hexColorGrown", diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/ColorJButton.java b/runelite-client/src/main/java/net/runelite/client/ui/components/ColorJButton.java new file mode 100644 index 0000000000..ec39027a57 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/ColorJButton.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2020, Martin H + * 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.ui.components; + +import java.awt.Color; +import java.awt.Graphics; +import javax.swing.JButton; +import lombok.Getter; + +public class ColorJButton extends JButton +{ + private static final int ALPHA_TEXT_CUTOFF = 120; + private static final int CHECKER_SIZE = 10; + + @Getter + private Color color; + + public ColorJButton(String text, Color color) + { + super(text); + + // Tell ButtonUI to not paint the background, we do it ourselves. + this.setContentAreaFilled(false); + + setColor(color); + } + + public void setColor(Color color) + { + this.color = color; + + // Use perceptive luminance to choose a readable font color + // Based on https://stackoverflow.com/a/1855903 + double lum = (0.299 * color.getRed() + 0.587 * color.getGreen() + 0.114 * color.getBlue()) / 255; + + final Color textColor; + + if (lum > 0.5 || color.getAlpha() < ALPHA_TEXT_CUTOFF) + { + textColor = Color.BLACK; + } + else + { + textColor = Color.WHITE; + } + + this.setForeground(textColor); + } + + @Override + public void paint(Graphics g) + { + if (this.color.getAlpha() != 255) + { + for (int x = 0; x < this.getWidth(); x += CHECKER_SIZE) + { + for (int y = 0; y < this.getHeight(); y += CHECKER_SIZE) + { + int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2; + g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE); + g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE); + } + } + } + + g.setColor(this.color); + g.fillRect(0, 0, this.getWidth(), this.getHeight()); + + super.paint(g); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/colorpicker/PreviewPanel.java b/runelite-client/src/main/java/net/runelite/client/ui/components/colorpicker/PreviewPanel.java index e602d4de50..a773e1f18d 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/colorpicker/PreviewPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/colorpicker/PreviewPanel.java @@ -49,13 +49,16 @@ class PreviewPanel extends JPanel { super.paint(g); - for (int x = 0; x < getWidth(); x += CHECKER_SIZE) + if (this.color.getAlpha() != 255) { - for (int y = 0; y < getHeight(); y += CHECKER_SIZE) + for (int x = 0; x < getWidth(); x += CHECKER_SIZE) { - int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2; - g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE); - g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE); + for (int y = 0; y < getHeight(); y += CHECKER_SIZE) + { + int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2; + g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE); + g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE); + } } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java index 912abab8f4..e5fc071ae3 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java @@ -40,6 +40,7 @@ import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.TileObject; import net.runelite.api.coords.LocalPoint; +import net.runelite.client.util.ColorUtil; /** @@ -65,7 +66,7 @@ public class OverlayUtil { graphics.setColor(Color.BLACK); graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2 + 1, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS); - graphics.setColor(color); + graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF)); graphics.fillOval(mini.getX() - MINIMAP_DOT_RADIUS / 2, mini.getY() - MINIMAP_DOT_RADIUS / 2, MINIMAP_DOT_RADIUS, MINIMAP_DOT_RADIUS); } @@ -92,7 +93,7 @@ public class OverlayUtil graphics.setColor(Color.BLACK); graphics.drawString(text, x + 1, y + 1); - graphics.setColor(color); + graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF)); graphics.drawString(text, x, y); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java index 3b10b3561b..45326fea28 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/TextComponent.java @@ -32,6 +32,7 @@ import java.awt.Point; import java.util.regex.Pattern; import lombok.Setter; import net.runelite.client.ui.overlay.RenderableEntity; +import net.runelite.client.util.ColorUtil; import net.runelite.client.util.Text; @Setter @@ -100,7 +101,7 @@ public class TextComponent implements RenderableEntity } // actual text - graphics.setColor(color); + graphics.setColor(ColorUtil.colorWithAlpha(color, 0xFF)); graphics.drawString(text, position.x, position.y); } diff --git a/runelite-client/src/main/java/net/runelite/client/util/ColorUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ColorUtil.java index c0a0102ee1..6b39003f11 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ColorUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ColorUtil.java @@ -131,6 +131,24 @@ public class ColorUtil return String.format("%08x", color.getRGB()); } + /** + * Gets the same RGB color with the specified alpha value. + * + * @param color The RGB color to use. + * @param alpha The alpha value to use (0-255). + * @return A Color with the given RGB and alpha. + */ + public static Color colorWithAlpha(final Color color, int alpha) + { + if (color.getAlpha() == alpha) + { + return color; + } + + alpha = constrainValue(alpha); + return new Color((color.getRGB() & 0x00ffffff) | (alpha << 24), true); + } + /** * Determines if the passed hex string is an alpha hex color. * diff --git a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java index acbf6a44b1..8a531b18bc 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/ColorUtilTest.java @@ -24,25 +24,28 @@ */ package net.runelite.client.util; +import com.google.common.collect.ImmutableMap; import java.awt.Color; -import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; import org.junit.Test; public class ColorUtilTest { - private static final Map COLOR_HEXSTRING_MAP = new HashMap() - {{ - put(Color.BLACK, "000000"); - put(new Color(0x1), "000001"); - put(new Color(0x100000), "100000"); - put(Color.RED, "ff0000"); - put(Color.GREEN, "00ff00"); - put(Color.BLUE, "0000ff"); - put(new Color(0xA1B2C3), "a1b2c3"); - put(Color.WHITE, "ffffff"); - }}; + private static final Map COLOR_HEXSTRING_MAP = new ImmutableMap.Builder(). + put(Color.BLACK, "000000"). + put(new Color(0x1), "000001"). + put(new Color(0x100000), "100000"). + put(Color.RED, "ff0000"). + put(Color.GREEN, "00ff00"). + put(Color.BLUE, "0000ff"). + put(new Color(0xA1B2C3), "a1b2c3"). + put(Color.WHITE, "ffffff").build(); + + private static final Map COLOR_ALPHA_HEXSTRING_MAP = ImmutableMap.of( + new Color(0x00000000, true), "00000000", + new Color(0xA1B2C3D4, true), "a1b2c3d4" + ); @Test public void colorTag() @@ -84,6 +87,28 @@ public class ColorUtilTest }); } + @Test + public void colorWithAlpha() + { + int[] alpha = {73}; + + COLOR_HEXSTRING_MAP.forEach((color, hex) -> + { + assertEquals(new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha[0]), + ColorUtil.colorWithAlpha(color, alpha[0])); + alpha[0] += 73; + alpha[0] %= 255; + }); + + COLOR_ALPHA_HEXSTRING_MAP.forEach((color, hex) -> + { + assertEquals(new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha[0]), + ColorUtil.colorWithAlpha(color, alpha[0])); + alpha[0] += 73; + alpha[0] %= 255; + }); + } + @Test public void colorLerp() { From 175f436f4882cedf1942bbce5b718f3d39264c70 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 20 Dec 2020 12:54:22 -0500 Subject: [PATCH 100/173] ping: place IcmpCloseHandle in finally If toIntExact() throws then this would leak the handle --- .../client/plugins/worldhopper/ping/Ping.java | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java index fd9a84fa57..42c88d4975 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java @@ -66,26 +66,29 @@ public class Ping { IPHlpAPI ipHlpAPI = IPHlpAPI.INSTANCE; Pointer ptr = ipHlpAPI.IcmpCreateFile(); - InetAddress inetAddress = InetAddress.getByName(world.getAddress()); - byte[] address = inetAddress.getAddress(); - String dataStr = RUNELITE_PING; - int dataLength = dataStr.length() + 1; - Pointer data = new Memory(dataLength); - data.setString(0L, dataStr); - IcmpEchoReply icmpEchoReply = new IcmpEchoReply(new Memory(IcmpEchoReply.SIZE + dataLength)); - assert icmpEchoReply.size() == IcmpEchoReply.SIZE; - int packed = (address[0] & 0xff) | ((address[1] & 0xff) << 8) | ((address[2] & 0xff) << 16) | ((address[3] & 0xff) << 24); - int ret = ipHlpAPI.IcmpSendEcho(ptr, packed, data, (short) (dataLength), Pointer.NULL, icmpEchoReply, IcmpEchoReply.SIZE + dataLength, TIMEOUT); - if (ret != 1) + try + { + InetAddress inetAddress = InetAddress.getByName(world.getAddress()); + byte[] address = inetAddress.getAddress(); + String dataStr = RUNELITE_PING; + int dataLength = dataStr.length() + 1; + Pointer data = new Memory(dataLength); + data.setString(0L, dataStr); + IcmpEchoReply icmpEchoReply = new IcmpEchoReply(new Memory(IcmpEchoReply.SIZE + dataLength)); + assert icmpEchoReply.size() == IcmpEchoReply.SIZE; + int packed = (address[0] & 0xff) | ((address[1] & 0xff) << 8) | ((address[2] & 0xff) << 16) | ((address[3] & 0xff) << 24); + int ret = ipHlpAPI.IcmpSendEcho(ptr, packed, data, (short) (dataLength), Pointer.NULL, icmpEchoReply, IcmpEchoReply.SIZE + dataLength, TIMEOUT); + if (ret != 1) + { + return -1; + } + + return Math.toIntExact(icmpEchoReply.roundTripTime.longValue()); + } + finally { ipHlpAPI.IcmpCloseHandle(ptr); - return -1; } - - int rtt = Math.toIntExact(icmpEchoReply.roundTripTime.longValue()); - ipHlpAPI.IcmpCloseHandle(ptr); - - return rtt; } private static int tcpPing(World world) throws IOException From 1e27c2f5ff98d35974d978c9287dd10cec13af05 Mon Sep 17 00:00:00 2001 From: Paul Norton Date: Thu, 12 Nov 2020 16:11:03 -0500 Subject: [PATCH 101/173] Add "scorched" Lletya regionID recognition to TimeTracking's FarmingWorld --- .../client/plugins/timetracking/farming/FarmingWorld.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java index 9d9812b319..9604c6045c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java @@ -193,7 +193,7 @@ class FarmingWorld add(new FarmingRegion("Lletya", 9265, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) - )); + ), 11103); add(new FarmingRegion("Lumbridge", 12851, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) From 943d69d8bba5ffe9e66c4fdfd1f68b906d730b72 Mon Sep 17 00:00:00 2001 From: Paul Norton Date: Mon, 21 Dec 2020 13:52:05 -0500 Subject: [PATCH 102/173] Add scorched Lletya region ID to discord presence determination --- .../runelite/client/plugins/discord/DiscordGameEventType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java index d5a728a368..f14b259277 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java @@ -121,7 +121,7 @@ enum DiscordGameEventType CITY_JATIZSO("Jatizso" , DiscordAreaType.CITIES, 9531), CITY_KELDAGRIM("Keldagrim" , DiscordAreaType.CITIES, 11423, 11422, 11679, 11678), CITY_LANDS_END("Land's End", DiscordAreaType.CITIES, 5941), - CITY_LLETYA("Lletya" , DiscordAreaType.CITIES, 9265), + CITY_LLETYA("Lletya" , DiscordAreaType.CITIES, 9265, 11103), CITY_LOVAKENGJ_HOUSE("Lovakengj" , DiscordAreaType.CITIES, 5692, 5691, 5947, 6203, 6202, 5690, 5946), CITY_LUMBRIDGE("Lumbridge" , DiscordAreaType.CITIES, 12850), CITY_LUNAR_ISLE("Lunar Isle" , DiscordAreaType.CITIES, 8253, 8252, 8509, 8508), From 74a881d3a987ae42a5c8396c00efe30d70b51188 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 22 Dec 2020 04:09:23 -0700 Subject: [PATCH 103/173] music: fix channel mute op name --- .../java/net/runelite/client/plugins/music/MusicPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java index 63e6fe2f2c..6f3421b08a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java @@ -573,7 +573,7 @@ public class MusicPlugin extends Plugin // emulate [proc,settings_update_icon] boolean unmuted = val != 0; icon.getChild(1).setHidden(unmuted); - icon.setAction(0, unmuted ? "Unmute" : "Mute"); + icon.setAction(0, unmuted ? "Mute" : "Unmute"); // Set name + no tooltip; we have our own for ops icon.setName(channel.getName()); icon.setOnMouseRepeatListener((Object[]) null); From a0dec6a6327164019c066c6cc0ce86dd26be4913 Mon Sep 17 00:00:00 2001 From: Malfuryent Date: Wed, 23 Dec 2020 09:44:16 +0100 Subject: [PATCH 104/173] statusbarplugin: Recolor health bar when infected by a parasite (#12874) --- runelite-api/src/main/java/net/runelite/api/Varbits.java | 9 +++++++++ .../client/plugins/statusbars/StatusBarsOverlay.java | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index 79d38b7e78..418c56bb6c 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -579,6 +579,15 @@ public enum Varbits MUTED_SOUND_EFFECT_VOLUME(9674), MUTED_AREA_EFFECT_VOLUME(9675), + /** + * Parasite infection status during nightmare of ashihama bossfight + * + * 0 = not infected + * 1 = infected + * + */ + PARASITE(10151), + /** * Whether the Special Attack orb is disabled due to being in a PvP area * diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java index 2d76c59b41..55a9603d6a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java @@ -69,6 +69,7 @@ class StatusBarsOverlay extends Overlay private static final Color SPECIAL_ATTACK_COLOR = new Color(3, 153, 0, 195); private static final Color ENERGY_COLOR = new Color(199, 174, 0, 220); private static final Color DISEASE_COLOR = new Color(255, 193, 75, 181); + private static final Color PARASITE_COLOR = new Color(196, 62, 109, 181); private static final int HEIGHT = 252; private static final int RESIZED_BOTTOM_HEIGHT = 272; private static final int IMAGE_SIZE = 17; @@ -132,6 +133,11 @@ class StatusBarsOverlay extends Overlay return DISEASE_COLOR; } + if (client.getVar(Varbits.PARASITE) >= 1) + { + return PARASITE_COLOR; + } + return HEALTH_COLOR; }, () -> HEAL_COLOR, From a9987a21d223d5abe2b28240e5f4690eb8708729 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Sat, 12 Dec 2020 17:32:03 -0500 Subject: [PATCH 105/173] item identification: add Jungle Potion herbs --- .../plugins/itemidentification/ItemIdentification.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java index 0e14e2dd85..fadbf29c59 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java @@ -64,6 +64,12 @@ enum ItemIdentification DWARF_WEED(Type.HERB, "Dwarf", "D", ItemID.DWARF_WEED, ItemID.GRIMY_DWARF_WEED), TORSTOL(Type.HERB, "Torstol", "TOR", ItemID.TORSTOL, ItemID.GRIMY_TORSTOL), + ARDRIGAL(Type.HERB, "Ardrig", "ARD", ItemID.ARDRIGAL, ItemID.GRIMY_ARDRIGAL), + ROGUES_PURSE(Type.HERB, "Rogue", "ROG", ItemID.ROGUES_PURSE, ItemID.GRIMY_ROGUES_PURSE), + SITO_FOIL(Type.HERB, "Sito", "SF", ItemID.SITO_FOIL, ItemID.GRIMY_SITO_FOIL), + SNAKE_WEED(Type.HERB, "Snake", "SW", ItemID.SNAKE_WEED, ItemID.GRIMY_SNAKE_WEED), + VOLENCIA_MOSS(Type.HERB, "Volenc", "V", ItemID.VOLENCIA_MOSS, ItemID.GRIMY_VOLENCIA_MOSS), + //Saplings OAK_SAPLING(Type.SAPLING, "Oak", "OAK", ItemID.OAK_SAPLING, ItemID.OAK_SEEDLING, ItemID.OAK_SEEDLING_W), WILLOW_SAPLING(Type.SAPLING, "Willow", "WIL", ItemID.WILLOW_SAPLING, ItemID.WILLOW_SEEDLING, ItemID.WILLOW_SEEDLING_W), From 0c2f93d11c41ba3292841d425681ee545a98cd2d Mon Sep 17 00:00:00 2001 From: Mrnice98 <49848962+Mrnice98@users.noreply.github.com> Date: Thu, 24 Dec 2020 00:54:30 -0500 Subject: [PATCH 106/173] timers: use chat message for sire stun timer This makes the timer work more reliably when stuns are stacked --- .../client/plugins/timers/TimersPlugin.java | 29 ++++--------------- .../plugins/timers/TimersPluginTest.java | 14 +++++++++ 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 92d6b87893..fb8572a853 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -59,7 +59,6 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.GraphicChanged; import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; import net.runelite.api.widgets.Widget; @@ -84,6 +83,7 @@ import org.apache.commons.lang3.ArrayUtils; @Slf4j public class TimersPlugin extends Plugin { + private static final String ABYSSAL_SIRE_STUN_MESSAGE = "The Sire has been disorientated temporarily."; private static final String ANTIFIRE_DRINK_MESSAGE = "You drink some of your antifire potion."; private static final String ANTIFIRE_EXPIRED_MESSAGE = "Your antifire potion has expired."; private static final String CANNON_FURNACE_MESSAGE = "You add the furnace."; @@ -450,6 +450,11 @@ public class TimersPlugin extends Plugin return; } + if (message.equals(ABYSSAL_SIRE_STUN_MESSAGE) && config.showAbyssalSireStun()) + { + createGameTimer(ABYSSAL_SIRE_STUN); + } + if (message.equals(ENDURANCE_EFFECT_MESSAGE)) { wasWearingEndurance = true; @@ -805,28 +810,6 @@ public class TimersPlugin extends Plugin } } - @Subscribe - public void onNpcChanged(NpcChanged npcChanged) - { - int id = npcChanged.getNpc().getId(); - int oldId = npcChanged.getOld().getId(); - - if (id == NpcID.ABYSSAL_SIRE_5888) - { - // stunned npc type - log.debug("Sire is stunned"); - if (config.showAbyssalSireStun()) - { - createGameTimer(ABYSSAL_SIRE_STUN); - } - } - else if (oldId == NpcID.ABYSSAL_SIRE_5888) - { - // change from stunned sire to anything else - log.debug("Sire is unstunned"); - removeGameTimer(ABYSSAL_SIRE_STUN); - } - } @Subscribe public void onAnimationChanged(AnimationChanged event) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java index 20a1df10d1..ab7a254c6d 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java @@ -240,6 +240,20 @@ public class TimersPluginTest assertEquals(Duration.ofMinutes(2), infoBox.getDuration()); } + @Test + public void testSireStunTimer() + { + when(timersConfig.showAbyssalSireStun()).thenReturn(true); + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "The Sire has been disorientated temporarily.", "", 0); + timersPlugin.onChatMessage(chatMessage); + + ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class); + verify(infoBoxManager).addInfoBox(captor.capture()); + TimerTimer infoBox = (TimerTimer) captor.getValue(); + assertEquals(GameTimer.ABYSSAL_SIRE_STUN, infoBox.getTimer()); + assertEquals(Duration.ofSeconds(30), infoBox.getDuration()); + } + @Test public void testEndurance() { From 85a953e76b7057b488adc841590ef996108ac650 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Dec 2020 15:31:03 -0500 Subject: [PATCH 107/173] api: remove WidgetHiddenChanged This has been superseded by script hooks on the scripts which hide the widgets --- .../api/events/WidgetHiddenChanged.java | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java deleted file mode 100644 index f3b3eb580e..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java +++ /dev/null @@ -1,44 +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.api.events; - -import lombok.Data; -import net.runelite.api.widgets.Widget; - -/** - * An event where the hidden state of a {@link Widget} has been modified. - */ -@Data -public class WidgetHiddenChanged -{ - /** - * The affected widget. - */ - private Widget widget; - /** - * The new hidden state of the widget. - */ - private boolean hidden; -} From ffebb9cf0c7e42949afdc3b2151100c2debd1f13 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Dec 2020 14:57:56 -0500 Subject: [PATCH 108/173] ge plugin: better handle trades updating on login After login there are two sets of offer updates, I suspect the first is from the server and the second is from the ge server - this also flags ge server trade updates as on login. To do this we assume it always happens in the first few ticks after the login burst. --- .../grandexchange/GrandExchangePlugin.java | 46 +++++----- .../GrandExchangePluginTest.java | 86 +++++++++++++++++++ 2 files changed, 112 insertions(+), 20 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 240ea3b8d4..95a154221e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -119,7 +119,9 @@ import org.apache.commons.text.similarity.FuzzyScore; @Slf4j public class GrandExchangePlugin extends Plugin { - private static final int GE_SLOTS = 8; + @VisibleForTesting + static final int GE_SLOTS = 8; + private static final int GE_LOGIN_BURST_WINDOW = 2; // ticks private static final int OFFER_CONTAINER_ITEM = 21; private static final int OFFER_DEFAULT_ITEM_ID = 6512; private static final String OSB_GE_TEXT = "
    OSBuddy Actively traded price: "; @@ -141,6 +143,7 @@ public class GrandExchangePlugin extends Plugin private NavigationButton button; @Getter(AccessLevel.PACKAGE) + @Setter(AccessLevel.PACKAGE) private GrandExchangePanel panel; @Getter(AccessLevel.PACKAGE) @@ -189,7 +192,7 @@ public class GrandExchangePlugin extends Plugin @Inject private GrandExchangeClient grandExchangeClient; - private boolean loginBurstGeUpdates; + private int lastLoginTick; @Inject private OSBGrandExchangeClient osbGrandExchangeClient; @@ -314,6 +317,8 @@ public class GrandExchangePlugin extends Plugin osbItem = -1; osbGrandExchangeResult = null; + + lastLoginTick = -1; } @Override @@ -370,12 +375,12 @@ public class GrandExchangePlugin extends Plugin if (offer.getState() == GrandExchangeOfferState.EMPTY && client.getGameState() != GameState.LOGGED_IN) { // Trades are cleared by the client during LOGIN_SCREEN/HOPPING/LOGGING_IN, ignore those so we don't - // zero and re-submit the trade on login as an update + // clear the offer config. return; } - log.debug("GE offer updated: state: {}, slot: {}, item: {}, qty: {}, login: {}", - offer.getState(), slot, offer.getItemId(), offer.getQuantitySold(), loginBurstGeUpdates); + log.debug("GE offer updated: state: {}, slot: {}, item: {}, qty: {}, lastLoginTick: {}", + offer.getState(), slot, offer.getItemId(), offer.getQuantitySold(), lastLoginTick); ItemComposition offerItem = itemManager.getItemComposition(offer.getItemId()); boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1; @@ -385,11 +390,6 @@ public class GrandExchangePlugin extends Plugin submitTrade(slot, offer); updateConfig(slot, offer); - - if (loginBurstGeUpdates && slot == GE_SLOTS - 1) // slots are sent sequentially on login; this is the last one - { - loginBurstGeUpdates = false; - } } @VisibleForTesting @@ -403,6 +403,7 @@ public class GrandExchangePlugin extends Plugin } SavedOffer savedOffer = getOffer(slot); + boolean login = client.getTickCount() <= lastLoginTick + GE_LOGIN_BURST_WINDOW; if (savedOffer == null && (state == GrandExchangeOfferState.BUYING || state == GrandExchangeOfferState.SELLING) && offer.getQuantitySold() == 0) { // new offer @@ -413,7 +414,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setOffer(offer.getPrice()); grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); - grandExchangeTrade.setLogin(loginBurstGeUpdates); + grandExchangeTrade.setLogin(login); log.debug("Submitting new trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -444,7 +445,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setOffer(offer.getPrice()); grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); - grandExchangeTrade.setLogin(loginBurstGeUpdates); + grandExchangeTrade.setLogin(login); log.debug("Submitting cancelled: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -469,7 +470,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setOffer(offer.getPrice()); grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); - grandExchangeTrade.setLogin(loginBurstGeUpdates); + grandExchangeTrade.setLogin(login); log.debug("Submitting trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -532,14 +533,19 @@ public class GrandExchangePlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged gameStateChanged) { - if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN) + switch (gameStateChanged.getGameState()) { - panel.getOffersPanel().resetOffers(); - loginBurstGeUpdates = true; - } - else if (gameStateChanged.getGameState() == GameState.LOGGED_IN) - { - grandExchangeClient.setMachineId(getMachineUuid()); + case LOGIN_SCREEN: + panel.getOffersPanel().resetOffers(); + break; + case LOGGING_IN: + case HOPPING: + case CONNECTION_LOST: + lastLoginTick = client.getTickCount(); + break; + case LOGGED_IN: + grandExchangeClient.setMachineId(getMachineUuid()); + break; } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java index 71db8a25db..e627dac19b 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangePluginTest.java @@ -29,15 +29,19 @@ import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.BoundFieldModule; import java.util.Arrays; import java.util.EnumSet; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.GrandExchangeOffer; import net.runelite.api.GrandExchangeOfferState; +import net.runelite.api.ItemComposition; import net.runelite.api.ItemID; import net.runelite.api.WorldType; +import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.client.Notifier; import net.runelite.client.account.SessionManager; @@ -52,14 +56,18 @@ import net.runelite.http.api.ge.GrandExchangeClient; import net.runelite.http.api.ge.GrandExchangeTrade; import net.runelite.http.api.osbuddy.OSBGrandExchangeClient; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import org.mockito.Mock; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -243,4 +251,82 @@ public class GrandExchangePluginTest verify(configManager, never()).unsetRSProfileConfiguration(anyString(), anyString()); } + + @Test + public void testLogin() + { + GrandExchangePanel panel = mock(GrandExchangePanel.class); + when(panel.getOffersPanel()).thenReturn(mock(GrandExchangeOffersPanel.class)); + grandExchangePlugin.setPanel(panel); + + when(itemManager.getItemComposition(anyInt())).thenReturn(mock(ItemComposition.class)); + + // provide config support so getOffer and setOffer work + final Map config = new HashMap<>(); + doAnswer(a -> + { + Object[] arguments = a.getArguments(); + config.put((String) arguments[1], arguments[2]); + return null; + }).when(configManager).setRSProfileConfiguration(eq("geoffer"), anyString(), anyString()); + + when(configManager.getRSProfileConfiguration(eq("geoffer"), anyString())).thenAnswer(a -> + { + Object[] arguments = a.getArguments(); + return config.get((String) arguments[1]); + }); + + // set loginBurstGeUpdates + GameStateChanged gameStateChanged = new GameStateChanged(); + gameStateChanged.setGameState(GameState.LOGIN_SCREEN); + + grandExchangePlugin.onGameStateChanged(gameStateChanged); + + // 8x buy 10 whip @ 1k ea, bought 1 sofar. + for (int i = 0; i < GrandExchangePlugin.GE_SLOTS; ++i) + { + GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); + when(grandExchangeOffer.getQuantitySold()).thenReturn(1); + when(grandExchangeOffer.getItemId()).thenReturn(ItemID.ABYSSAL_WHIP); + when(grandExchangeOffer.getTotalQuantity()).thenReturn(10); + when(grandExchangeOffer.getPrice()).thenReturn(1000); + when(grandExchangeOffer.getSpent()).thenReturn(1000); + when(grandExchangeOffer.getState()).thenReturn(GrandExchangeOfferState.SELLING); + + GrandExchangeOfferChanged grandExchangeOfferChanged = new GrandExchangeOfferChanged(); + grandExchangeOfferChanged.setSlot(i); + grandExchangeOfferChanged.setOffer(grandExchangeOffer); + grandExchangePlugin.onGrandExchangeOfferChanged(grandExchangeOfferChanged); + } + + // Now send update for one of the slots + GrandExchangeOffer grandExchangeOffer = mock(GrandExchangeOffer.class); + when(grandExchangeOffer.getQuantitySold()).thenReturn(2); + when(grandExchangeOffer.getItemId()).thenReturn(ItemID.ABYSSAL_WHIP); + when(grandExchangeOffer.getTotalQuantity()).thenReturn(10); + when(grandExchangeOffer.getPrice()).thenReturn(1000); + when(grandExchangeOffer.getSpent()).thenReturn(2000); + when(grandExchangeOffer.getState()).thenReturn(GrandExchangeOfferState.SELLING); + + GrandExchangeOfferChanged grandExchangeOfferChanged = new GrandExchangeOfferChanged(); + grandExchangeOfferChanged.setSlot(2); + grandExchangeOfferChanged.setOffer(grandExchangeOffer); + grandExchangePlugin.onGrandExchangeOfferChanged(grandExchangeOfferChanged); + + // verify trade update + ArgumentCaptor captor = ArgumentCaptor.forClass(GrandExchangeTrade.class); + verify(grandExchangeClient).submit(captor.capture()); + + GrandExchangeTrade trade = captor.getValue(); + assertFalse(trade.isBuy()); + assertEquals(ItemID.ABYSSAL_WHIP, trade.getItemId()); + assertEquals(2, trade.getQty()); + assertEquals(1, trade.getDqty()); + assertEquals(10, trade.getTotal()); + assertEquals(1000, trade.getDspent()); + assertEquals(2000, trade.getSpent()); + assertEquals(1000, trade.getOffer()); + assertEquals(2, trade.getSlot()); + assertTrue(trade.isLogin()); + } } \ No newline at end of file From 2c8984e380c84f415a485db24ad37fe367553186 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Dec 2020 15:06:23 -0500 Subject: [PATCH 109/173] ge: add user agent to trade message --- .../net/runelite/http/service/ge/GrandExchangeController.java | 1 + .../src/main/java/net/runelite/http/service/ge/Trade.java | 1 + 2 files changed, 2 insertions(+) diff --git a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java index c6eaf85b15..a8922a27be 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java @@ -101,6 +101,7 @@ public class GrandExchangeController trade.setMachineId(request.getHeader(RuneLiteAPI.RUNELITE_MACHINEID)); trade.setUserId(userId); trade.setIp(request.getHeader("X-Forwarded-For")); + trade.setUa(request.getHeader("User-Agent")); trade.setWorldType(grandExchangeTrade.getWorldType()); String json = GSON.toJson(trade); diff --git a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java index 3a6d64fb30..56cdc304a0 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java @@ -44,5 +44,6 @@ class Trade private String machineId; private Integer userId; private String ip; + private String ua; private WorldType worldType; } From 9a322c70d0bf044e64a4ca902b199a8f535cc7f6 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Dec 2020 18:01:58 -0500 Subject: [PATCH 110/173] ge: add trade seq number Occasionally the trades are delivered out of order, this allows us to reassemble them in the correct order --- .../java/net/runelite/http/api/ge/GrandExchangeTrade.java | 1 + .../runelite/http/service/ge/GrandExchangeController.java | 1 + .../src/main/java/net/runelite/http/service/ge/Trade.java | 1 + .../client/plugins/grandexchange/GrandExchangePlugin.java | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java index 0ab9260f7f..789ca45e63 100644 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java @@ -42,4 +42,5 @@ public class GrandExchangeTrade private int offer; private int slot; private WorldType worldType; + private int seq; } diff --git a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java index a8922a27be..73d78986e6 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java @@ -103,6 +103,7 @@ public class GrandExchangeController trade.setIp(request.getHeader("X-Forwarded-For")); trade.setUa(request.getHeader("User-Agent")); trade.setWorldType(grandExchangeTrade.getWorldType()); + trade.setSeq(grandExchangeTrade.getSeq()); String json = GSON.toJson(trade); try (Jedis jedis = redisPool.getResource()) diff --git a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java index 56cdc304a0..bec26b3334 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java @@ -46,4 +46,5 @@ class Trade private String ip; private String ua; private WorldType worldType; + private int seq; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 95a154221e..a7e9ee3c74 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -201,6 +201,7 @@ public class GrandExchangePlugin extends Plugin private String machineUuid; private String lastUsername; + private int tradeSeq; /** * Logic from {@link org.apache.commons.text.similarity.FuzzyScore} @@ -330,6 +331,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeText = null; grandExchangeItem = null; lastUsername = machineUuid = null; + tradeSeq = 0; } @Subscribe @@ -415,6 +417,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); + grandExchangeTrade.setSeq(tradeSeq++); log.debug("Submitting new trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -446,6 +449,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); + grandExchangeTrade.setSeq(tradeSeq++); log.debug("Submitting cancelled: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -471,6 +475,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setSlot(slot); grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); + grandExchangeTrade.setSeq(tradeSeq++); log.debug("Submitting trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -958,12 +963,14 @@ public class GrandExchangePlugin extends Plugin } hasher.putUnencodedChars(username); machineUuid = hasher.hash().toString(); + tradeSeq = 0; return machineUuid; } catch (SocketException ex) { log.debug("unable to generate machine id", ex); machineUuid = null; + tradeSeq = 0; return null; } } From e3b75c8b7acaee5f6610ab53f5014e763dfd81a6 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Dec 2020 19:58:22 -0500 Subject: [PATCH 111/173] ge: submit buy limit reset time --- .../java/net/runelite/http/api/ge/GrandExchangeTrade.java | 2 ++ .../runelite/http/service/ge/GrandExchangeController.java | 3 +++ .../src/main/java/net/runelite/http/service/ge/Trade.java | 1 + .../client/plugins/grandexchange/GrandExchangePlugin.java | 7 +++++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java index 789ca45e63..fd6f6635d3 100644 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeTrade.java @@ -24,6 +24,7 @@ */ package net.runelite.http.api.ge; +import java.time.Instant; import lombok.Data; import net.runelite.http.api.worlds.WorldType; @@ -43,4 +44,5 @@ public class GrandExchangeTrade private int slot; private WorldType worldType; private int seq; + private Instant resetTime; } diff --git a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java index 73d78986e6..509f2bdb70 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/GrandExchangeController.java @@ -26,6 +26,7 @@ package net.runelite.http.service.ge; import com.google.gson.Gson; import java.io.IOException; +import java.time.Instant; import java.util.Collection; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; @@ -104,6 +105,8 @@ public class GrandExchangeController trade.setUa(request.getHeader("User-Agent")); trade.setWorldType(grandExchangeTrade.getWorldType()); trade.setSeq(grandExchangeTrade.getSeq()); + Instant resetTime = grandExchangeTrade.getResetTime(); + trade.setResetTime(resetTime == null ? 0L : resetTime.getEpochSecond()); String json = GSON.toJson(trade); try (Jedis jedis = redisPool.getResource()) diff --git a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java index bec26b3334..7ad01f322a 100644 --- a/http-service/src/main/java/net/runelite/http/service/ge/Trade.java +++ b/http-service/src/main/java/net/runelite/http/service/ge/Trade.java @@ -47,4 +47,5 @@ class Trade private String ua; private WorldType worldType; private int seq; + private long resetTime; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index a7e9ee3c74..4e7886292e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -389,6 +389,8 @@ public class GrandExchangePlugin extends Plugin BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack); SwingUtilities.invokeLater(() -> panel.getOffersPanel().updateOffer(offerItem, itemImage, offer, slot)); + updateLimitTimer(offer); + submitTrade(slot, offer); updateConfig(slot, offer); @@ -418,6 +420,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); grandExchangeTrade.setSeq(tradeSeq++); + grandExchangeTrade.setResetTime(getLimitResetTime(offer.getItemId())); log.debug("Submitting new trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -450,6 +453,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); grandExchangeTrade.setSeq(tradeSeq++); + grandExchangeTrade.setResetTime(getLimitResetTime(offer.getItemId())); log.debug("Submitting cancelled: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -476,6 +480,7 @@ public class GrandExchangePlugin extends Plugin grandExchangeTrade.setWorldType(getGeWorldType()); grandExchangeTrade.setLogin(login); grandExchangeTrade.setSeq(tradeSeq++); + grandExchangeTrade.setResetTime(getLimitResetTime(offer.getItemId())); log.debug("Submitting trade: {}", grandExchangeTrade); grandExchangeClient.submit(grandExchangeTrade); @@ -514,8 +519,6 @@ public class GrandExchangePlugin extends Plugin savedOffer.setSpent(offer.getSpent()); savedOffer.setState(offer.getState()); setOffer(slot, savedOffer); - - updateLimitTimer(offer); } } From 7898c466302a6f32282122f8a6d7cc9ef2d9862b Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 27 Dec 2020 10:20:04 -0700 Subject: [PATCH 112/173] runelite-api: add WidgetClosed event --- .../net/runelite/api/events/WidgetClosed.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/WidgetClosed.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetClosed.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetClosed.java new file mode 100644 index 0000000000..42193b445f --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetClosed.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Abex + * 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.api.events; + +import lombok.Value; + +/** + * Posted when an interface is about to be closed + */ +@Value +public class WidgetClosed +{ + /** + * The ID of the interface that is closed + */ + private final int groupId; + + /** + * @see net.runelite.api.widgets.WidgetModalMode + */ + private final int modalMode; + + /** + * If the interface will be unloaded or if it will be immediately reloaded + */ + private final boolean unload; +} From 27ea3fbab689764a9cdf7483cd92cf768402b16d Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 27 Dec 2020 10:20:55 -0700 Subject: [PATCH 113/173] runelite-api: add WidgetNode::modalMode --- .../java/net/runelite/api/WidgetNode.java | 5 +++ .../runelite/api/widgets/WidgetModalMode.java | 32 +++++++++++++++++++ .../devtools/WidgetInfoTableModel.java | 18 +++++++++-- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/widgets/WidgetModalMode.java diff --git a/runelite-api/src/main/java/net/runelite/api/WidgetNode.java b/runelite-api/src/main/java/net/runelite/api/WidgetNode.java index dbdaf9936e..494a33c40f 100644 --- a/runelite-api/src/main/java/net/runelite/api/WidgetNode.java +++ b/runelite-api/src/main/java/net/runelite/api/WidgetNode.java @@ -36,4 +36,9 @@ public interface WidgetNode extends Node * @see net.runelite.api.widgets.Widget */ int getId(); + + /** + * @see net.runelite.api.widgets.WidgetModalMode + */ + int getModalMode(); } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetModalMode.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetModalMode.java new file mode 100644 index 0000000000..9c875fa3fd --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetModalMode.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 Abex + * 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.api.widgets; + +public class WidgetModalMode +{ + public static final int MODAL_NOCLICKTHROUGH = 0; + public static final int NON_MODAL = 1; + public static final int MODAL_CLICKTHROUGH = 3; +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java index 2b515e5fb4..c996287728 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java @@ -32,6 +32,8 @@ import java.util.Map; import java.util.function.Function; import javax.swing.SwingUtilities; import javax.swing.table.AbstractTableModel; +import net.runelite.api.Client; +import net.runelite.api.WidgetNode; import net.runelite.api.widgets.Widget; import net.runelite.client.callback.ClientThread; @@ -40,10 +42,13 @@ public class WidgetInfoTableModel extends AbstractTableModel @Inject private ClientThread clientThread; + @Inject + private Client client; + private static final int COL_FIELD = 0; private static final int COL_VALUE = 1; - private static final List fields = populateWidgetFields(); + private final List fields = populateWidgetFields(); private Widget widget = null; private Map values = null; @@ -132,7 +137,7 @@ public class WidgetInfoTableModel extends AbstractTableModel }); } - private static List populateWidgetFields() + private List populateWidgetFields() { List out = new ArrayList<>(); @@ -194,6 +199,15 @@ public class WidgetInfoTableModel extends AbstractTableModel out.add(new WidgetField<>("NoScrollThrough", Widget::getNoScrollThrough, Widget::setNoScrollThrough, Boolean.class)); out.add(new WidgetField<>("TargetVerb", Widget::getTargetVerb, Widget::setTargetVerb, String.class)); out.add(new WidgetField<>("DragParent", Widget::getDragParent)); + out.add(new WidgetField<>("ModalMode", w -> + { + WidgetNode attachment = client.getComponentTable().get(w.getParentId()); + if (attachment != null) + { + return attachment.getModalMode(); + } + return null; + })); return out; } From 0381abddcbbad5aad71c471678af7e232d95ee9c Mon Sep 17 00:00:00 2001 From: Morgan Lewis Date: Mon, 21 Dec 2020 17:58:17 -0700 Subject: [PATCH 114/173] Add additional areas to FarmingRegions --- .../timetracking/farming/FarmingWorld.java | 106 ++++++++++++------ 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java index 9d9812b319..bbeab0a639 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java @@ -29,6 +29,7 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.inject.Singleton; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -36,6 +37,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; +import java.util.stream.Collectors; import lombok.Getter; import net.runelite.api.Varbits; import net.runelite.api.coords.WorldPoint; @@ -44,7 +46,7 @@ import net.runelite.client.plugins.timetracking.Tab; @Singleton class FarmingWorld { - @Getter + @SuppressWarnings("PMD.ImmutableField") private Multimap regions = HashMultimap.create(); @Getter @@ -64,11 +66,11 @@ class FarmingWorld // It may be worth it to add a specialization for these patches add(new FarmingRegion("Al Kharid", 13106, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CACTUS) - )); + ), 13362, 13105); add(new FarmingRegion("Ardougne", 10290, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH) - )); + ), 10546); add(new FarmingRegion("Ardougne", 10548, new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), @@ -80,7 +82,7 @@ class FarmingWorld add(new FarmingRegion("Brimhaven", 11058, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE), new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE) - )); + ), 11057); add(new FarmingRegion("Catherby", 11062, new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), @@ -93,9 +95,10 @@ class FarmingWorld @Override public boolean isInBounds(WorldPoint loc) { - if (loc.getY() < 3456) + if (loc.getX() >= 2816 && loc.getY() < 3456) { - return loc.getX() <= 2840 && loc.getY() > 3440; + //Upstairs sends different varbits + return loc.getX() < 2840 && loc.getY() >= 3440 && loc.getPlane() == 0; } return true; } @@ -104,10 +107,11 @@ class FarmingWorld new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) ) { + //The fruit tree patch is always sent when upstairs in 11317 @Override public boolean isInBounds(WorldPoint loc) { - return loc.getX() > 2840 || loc.getY() < 3440; + return loc.getX() >= 2840 || loc.getY() < 3440 || loc.getPlane() == 1; } }); @@ -121,7 +125,7 @@ class FarmingWorld add(new FarmingRegion("Entrana", 11060, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); + ), 11316); add(new FarmingRegion("Etceteria", 10300, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH), @@ -130,7 +134,7 @@ class FarmingWorld add(new FarmingRegion("Falador", 11828, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); + ), 12084); add(new FarmingRegion("Falador", 12083, new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), @@ -142,7 +146,8 @@ class FarmingWorld @Override public boolean isInBounds(WorldPoint loc) { - return loc.getY() > 3280; + //Not on region boundary due to Port Sarim Spirit Tree patch + return loc.getY() >= 3272; } }); @@ -150,7 +155,30 @@ class FarmingWorld new FarmingPatch("East", Varbits.FARMING_4771, PatchImplementation.HARDWOOD_TREE), new FarmingPatch("Middle", Varbits.FARMING_4772, PatchImplementation.HARDWOOD_TREE), new FarmingPatch("West", Varbits.FARMING_4773, PatchImplementation.HARDWOOD_TREE) - ), 14907); + ) + { + @Override + public boolean isInBounds(WorldPoint loc) + { + //Hardwood tree varbits are sent anywhere on plane 0 of fossil island. + //Varbits get sent 1 tick earlier than expected when climbing certain ladders and stairs + + //Stairs to house on the hill + if (loc.getX() == 3753 && loc.getY() >= 3868 && loc.getY() <= 3870) + { + return false; + } + + //East and west ladders to rope bridge + if ((loc.getX() == 3729 || loc.getX() == 3728 || loc.getX() == 3747 || loc.getX() == 3746) + && loc.getY() <= 3832 && loc.getY() >= 3830) + { + return false; + } + + return loc.getPlane() == 0; + } + }, 14907, 14908, 15164, 14652, 14906, 14650, 15162, 15163); add(new FarmingRegion("Seaweed", 15008, new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.SEAWEED), new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.SEAWEED) @@ -159,7 +187,7 @@ class FarmingWorld add(new FarmingRegion("Gnome Stronghold", 9781, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE), new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE) - )); + ), 9782, 9526, 9525); add(new FarmingRegion("Harmony", 15148, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), @@ -171,11 +199,9 @@ class FarmingWorld new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB), - new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.COMPOST) - )); - add(new FarmingRegion("Kourend", 6711, + new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.COMPOST), new FarmingPatch("", Varbits.FARMING_7904, PatchImplementation.SPIRIT_TREE) - )); + ), 6711); add(new FarmingRegion("Kourend", 7223, new FarmingPatch("East 1", Varbits.GRAPES_4953, PatchImplementation.GRAPES), new FarmingPatch("East 2", Varbits.GRAPES_4954, PatchImplementation.GRAPES), @@ -200,23 +226,29 @@ class FarmingWorld )); add(new FarmingRegion("Lumbridge", 12594, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); + ), 12850); add(new FarmingRegion("Morytania", 13622, new FarmingPatch("Mushroom", Varbits.FARMING_4771, PatchImplementation.MUSHROOM) - )); + ), 13878); add(new FarmingRegion("Morytania", 14391, new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB), new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.COMPOST) - )); - + ), 14390); add(new FarmingRegion("Port Sarim", 12082, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE) - )); + ) + { + @Override + public boolean isInBounds(WorldPoint loc) + { + return loc.getY() < 3272; + } + }, 12083); add(new FarmingRegion("Rimmington", 11570, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH) @@ -224,7 +256,7 @@ class FarmingWorld add(new FarmingRegion("Seers' Village", 10551, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); + ), 10550); add(new FarmingRegion("Tai Bwo Wannai", 11056, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CALQUAT) @@ -232,11 +264,11 @@ class FarmingWorld add(new FarmingRegion("Taverley", 11573, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); + ), 11829); add(new FarmingRegion("Tree Gnome Village", 9777, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) - )); + ), 10033); add(new FarmingRegion("Troll Stronghold", 11321, new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HERB) @@ -258,6 +290,7 @@ class FarmingWorld new FarmingPatch("Hespori", Varbits.FARMING_7908, PatchImplementation.HESPORI) )); + //Full 3x3 region area centered on farming guild add(farmingGuildRegion = new FarmingRegion("Farming Guild", 4922, new FarmingPatch("", Varbits.FARMING_7905, PatchImplementation.TREE), new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.HERB), @@ -272,18 +305,20 @@ class FarmingWorld new FarmingPatch("Anima", Varbits.FARMING_7911, PatchImplementation.ANIMA), new FarmingPatch("", Varbits.FARMING_7910, PatchImplementation.CELASTRUS), new FarmingPatch("", Varbits.FARMING_7907, PatchImplementation.REDWOOD) - )); + ), 5177, 5178, 5179, 4921, 4923, 4665, 4666, 4667); + //All of Prifddinas, and all of Prifddinas Underground add(new FarmingRegion("Prifddinas", 13151, - new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.CRYSTAL_TREE), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.COMPOST) // TODO: Find correct varbit - )); + new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), + new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), + new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), + new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.CRYSTAL_TREE), + new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.COMPOST) // TODO: Find correct varbit + ), 12895, 12894, 13150, + /* Underground */ 12994, 12993, 12737, 12738, 12126, 12127, 13250); // Finalize - this.regions = Multimaps.unmodifiableMultimap(regions); + this.regions = Multimaps.unmodifiableMultimap(this.regions); Map> umtabs = new TreeMap<>(); for (Map.Entry> e : tabs.entrySet()) { @@ -306,4 +341,11 @@ class FarmingWorld .add(p); } } + + Collection getRegionsForLocation(WorldPoint location) + { + return this.regions.get(location.getRegionID()).stream() + .filter(region -> region.isInBounds(location)) + .collect(Collectors.toSet()); + } } From 519968f568ec01a7970a50b3b776511aed173900 Mon Sep 17 00:00:00 2001 From: Morgan Lewis Date: Tue, 22 Dec 2020 13:41:13 -0700 Subject: [PATCH 115/173] Add Health Check data to PatchImplementation.java --- .../farming/PatchImplementation.java | 46 ++++++++-------- .../plugins/timetracking/farming/Produce.java | 54 +++++++------------ 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java index c4af8c2596..1707f0281e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java @@ -33,7 +33,7 @@ import net.runelite.client.plugins.timetracking.Tab; @Getter public enum PatchImplementation { - BELLADONNA(Tab.SPECIAL, "") + BELLADONNA(Tab.SPECIAL, "", false) { @Override PatchState forVarbitValue(int value) @@ -71,7 +71,7 @@ public enum PatchImplementation return null; } }, - MUSHROOM(Tab.SPECIAL, "") + MUSHROOM(Tab.SPECIAL, "", false) { @Override PatchState forVarbitValue(int value) @@ -109,7 +109,7 @@ public enum PatchImplementation return null; } }, - HESPORI(Tab.SPECIAL, "") + HESPORI(Tab.SPECIAL, "", true) { @Override PatchState forVarbitValue(int value) @@ -137,7 +137,7 @@ public enum PatchImplementation return null; } }, - ALLOTMENT(Tab.ALLOTMENT, "") + ALLOTMENT(Tab.ALLOTMENT, "", false) { @Override PatchState forVarbitValue(int value) @@ -470,7 +470,7 @@ public enum PatchImplementation return null; } }, - HERB(Tab.HERB, "") + HERB(Tab.HERB, "", false) { @Override PatchState forVarbitValue(int value) @@ -738,7 +738,7 @@ public enum PatchImplementation return null; } }, - FLOWER(Tab.FLOWER, "") + FLOWER(Tab.FLOWER, "", false) { @Override PatchState forVarbitValue(int value) @@ -1011,7 +1011,7 @@ public enum PatchImplementation return null; } }, - BUSH(Tab.BUSH, "") + BUSH(Tab.BUSH, "", true) { @Override PatchState forVarbitValue(int value) @@ -1244,7 +1244,7 @@ public enum PatchImplementation return null; } }, - FRUIT_TREE(Tab.FRUIT_TREE, "") + FRUIT_TREE(Tab.FRUIT_TREE, "", true) { @Override PatchState forVarbitValue(int value) @@ -1527,7 +1527,7 @@ public enum PatchImplementation return null; } }, - HOPS(Tab.HOPS, "") + HOPS(Tab.HOPS, "", false) { @Override PatchState forVarbitValue(int value) @@ -1830,7 +1830,7 @@ public enum PatchImplementation return null; } }, - TREE(Tab.TREE, "") + TREE(Tab.TREE, "", true) { @Override PatchState forVarbitValue(int value) @@ -2113,7 +2113,7 @@ public enum PatchImplementation return null; } }, - HARDWOOD_TREE(Tab.TREE, "Hardwood Trees") + HARDWOOD_TREE(Tab.TREE, "Hardwood Trees", true) { @Override PatchState forVarbitValue(int value) @@ -2196,7 +2196,7 @@ public enum PatchImplementation return null; } }, - REDWOOD(Tab.TREE, "Redwood Trees") + REDWOOD(Tab.TREE, "Redwood Trees", true) { @Override PatchState forVarbitValue(int value) @@ -2244,7 +2244,7 @@ public enum PatchImplementation return null; } }, - SPIRIT_TREE(Tab.TREE, "Spirit Trees") + SPIRIT_TREE(Tab.TREE, "Spirit Trees", true) { @Override PatchState forVarbitValue(int value) @@ -2292,7 +2292,7 @@ public enum PatchImplementation return null; } }, - ANIMA(Tab.SPECIAL, "") + ANIMA(Tab.SPECIAL, "", false) { @Override PatchState forVarbitValue(int value) @@ -2339,7 +2339,7 @@ public enum PatchImplementation return null; } }, - CACTUS(Tab.SPECIAL, "Cactus") + CACTUS(Tab.SPECIAL, "Cactus", true) { @Override PatchState forVarbitValue(int value) @@ -2412,7 +2412,7 @@ public enum PatchImplementation return null; } }, - SEAWEED(Tab.SPECIAL, "Seaweed") + SEAWEED(Tab.SPECIAL, "Seaweed", false) { @Override PatchState forVarbitValue(int value) @@ -2450,7 +2450,7 @@ public enum PatchImplementation return null; } }, - CALQUAT(Tab.FRUIT_TREE, "Calquat") + CALQUAT(Tab.FRUIT_TREE, "Calquat", true) { @Override PatchState forVarbitValue(int value) @@ -2493,7 +2493,7 @@ public enum PatchImplementation return null; } }, - CELASTRUS(Tab.FRUIT_TREE, "Celastrus") + CELASTRUS(Tab.FRUIT_TREE, "Celastrus", true) { @Override PatchState forVarbitValue(int value) @@ -2551,7 +2551,7 @@ public enum PatchImplementation return null; } }, - GRAPES(Tab.GRAPE, "") + GRAPES(Tab.GRAPE, "", true) { @Override PatchState forVarbitValue(int value) @@ -2576,7 +2576,7 @@ public enum PatchImplementation return null; } }, - CRYSTAL_TREE(Tab.FRUIT_TREE, "Crystal Tree") + CRYSTAL_TREE(Tab.FRUIT_TREE, "Crystal Tree", true) { @Override PatchState forVarbitValue(int value) @@ -2604,7 +2604,7 @@ public enum PatchImplementation return null; } }, - COMPOST(Tab.SPECIAL, "Compost Bin") + COMPOST(Tab.SPECIAL, "Compost Bin", true) { @Override PatchState forVarbitValue(int value) @@ -2677,7 +2677,7 @@ public enum PatchImplementation return null; } }, - GIANT_COMPOST(Tab.SPECIAL, "Giant Compost Bin") + GIANT_COMPOST(Tab.SPECIAL, "Giant Compost Bin", true) { @Override PatchState forVarbitValue(int value) @@ -2787,4 +2787,6 @@ public enum PatchImplementation private final Tab tab; private final String name; + + private final boolean healthCheckRequired; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java index ae19316f54..033b358ad6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java @@ -65,13 +65,13 @@ public enum Produce POISON_IVY("Poison ivy", "Poison ivy berries", PatchImplementation.BUSH, ItemID.POISON_IVY_BERRIES, 20, 9, 20, 5), // Hop crops - BARLEY("Barley", ItemID.BARLEY, 10, 5, 0, 3), - HAMMERSTONE("Hammerstone", ItemID.HAMMERSTONE_HOPS, 10, 5, 0, 3), - ASGARNIAN("Asgarnian", ItemID.ASGARNIAN_HOPS, 10, 6, 0, 3), - JUTE("Jute", ItemID.JUTE_FIBRE, 10, 6, 0, 3), - YANILLIAN("Yanillian", ItemID.YANILLIAN_HOPS, 10, 7, 0, 3), - KRANDORIAN("Krandorian", ItemID.KRANDORIAN_HOPS, 10, 8, 0, 3), - WILDBLOOD("Wildblood", ItemID.WILDBLOOD_HOPS, 10, 9, 0, 3), + BARLEY("Barley", PatchImplementation.HOPS, ItemID.BARLEY, 10, 5, 0, 3), + HAMMERSTONE("Hammerstone", PatchImplementation.HOPS, ItemID.HAMMERSTONE_HOPS, 10, 5, 0, 3), + ASGARNIAN("Asgarnian", PatchImplementation.HOPS, ItemID.ASGARNIAN_HOPS, 10, 6, 0, 3), + JUTE("Jute", PatchImplementation.HOPS, ItemID.JUTE_FIBRE, 10, 6, 0, 3), + YANILLIAN("Yanillian", PatchImplementation.HOPS, ItemID.YANILLIAN_HOPS, 10, 7, 0, 3), + KRANDORIAN("Krandorian", PatchImplementation.HOPS, ItemID.KRANDORIAN_HOPS, 10, 8, 0, 3), + WILDBLOOD("Wildblood", PatchImplementation.HOPS, ItemID.WILDBLOOD_HOPS, 10, 9, 0, 3), // Herb crops GUAM("Guam", PatchImplementation.HERB, ItemID.GUAM_LEAF, 20, 5, 0, 3), @@ -113,25 +113,25 @@ public enum Produce POTATO_CACTUS("Potato cactus", "Potato cacti", PatchImplementation.CACTUS, ItemID.POTATO_CACTUS, 10, 8, 5, 7), // Hardwood - TEAK("Teak", ItemID.TEAK_LOGS, 560, 8), - MAHOGANY("Mahogany", ItemID.MAHOGANY_LOGS, 640, 9), + TEAK("Teak", PatchImplementation.HARDWOOD_TREE, ItemID.TEAK_LOGS, 560, 8), + MAHOGANY("Mahogany", PatchImplementation.HARDWOOD_TREE, ItemID.MAHOGANY_LOGS, 640, 9), // Anima - ATTAS("Attas", NullItemID.NULL_22940, 640, 9), - IASOR("Iasor", NullItemID.NULL_22939, 640, 9), - KRONOS("Kronos", NullItemID.NULL_22938, 640, 9), + ATTAS("Attas", PatchImplementation.ANIMA, NullItemID.NULL_22940, 640, 9), + IASOR("Iasor", PatchImplementation.ANIMA, NullItemID.NULL_22939, 640, 9), + KRONOS("Kronos", PatchImplementation.ANIMA, NullItemID.NULL_22938, 640, 9), // Special crops - SEAWEED("Seaweed", ItemID.GIANT_SEAWEED, 10, 5, 0, 4), - GRAPE("Grape", ItemID.GRAPES, 5, 8, 0, 5), - MUSHROOM("Mushroom", ItemID.MUSHROOM, 40, 7, 0, 7), - BELLADONNA("Belladonna", ItemID.CAVE_NIGHTSHADE, 80, 5), - CALQUAT("Calquat", ItemID.CALQUAT_FRUIT, 160, 9, 0, 7), - SPIRIT_TREE("Spirit tree", ItemID.SPIRIT_TREE, 320, 13), + SEAWEED("Seaweed", PatchImplementation.SEAWEED, ItemID.GIANT_SEAWEED, 10, 5, 0, 4), + GRAPE("Grape", PatchImplementation.GRAPES, ItemID.GRAPES, 5, 8, 0, 5), + MUSHROOM("Mushroom", PatchImplementation.MUSHROOM, ItemID.MUSHROOM, 40, 7, 0, 7), + BELLADONNA("Belladonna", PatchImplementation.BELLADONNA, ItemID.CAVE_NIGHTSHADE, 80, 5), + CALQUAT("Calquat", PatchImplementation.CALQUAT, ItemID.CALQUAT_FRUIT, 160, 9, 0, 7), + SPIRIT_TREE("Spirit tree", PatchImplementation.SPIRIT_TREE, ItemID.SPIRIT_TREE, 320, 13), CELASTRUS("Celastrus", "Celastrus tree", PatchImplementation.CELASTRUS, ItemID.BATTLESTAFF, 160, 6, 0, 4), REDWOOD("Redwood", "Redwood tree", PatchImplementation.REDWOOD, ItemID.REDWOOD_LOGS, 640, 11), - HESPORI("Hespori", NullItemID.NULL_23044, 640, 4, 0, 2), - CRYSTAL_TREE("Crystal tree", ItemID.CRYSTAL_SHARDS, 80, 7), + HESPORI("Hespori", PatchImplementation.HESPORI, NullItemID.NULL_23044, 640, 4, 0, 2), + CRYSTAL_TREE("Crystal tree", PatchImplementation.CRYSTAL_TREE, ItemID.CRYSTAL_SHARDS, 80, 7), // Compost bins EMPTY_COMPOST_BIN("Compost Bin", PatchImplementation.COMPOST, ItemID.COMPOST_BIN, 0, 1, 0, 0), // Dummy produce for the empty state @@ -204,20 +204,6 @@ public enum Produce this(name, name, null, itemID, tickrate, stages, 0, 1); } - boolean requiresHealthCheck() - { - switch (this.patchImplementation) - { - case BUSH: - case TREE: - case CACTUS: - case REDWOOD: - case CELASTRUS: - return true; - } - return false; - } - @Nullable static Produce getByItemID(int itemId) { From d4e91c60cd794afa32ac5984ec92b961317487a8 Mon Sep 17 00:00:00 2001 From: Morgan Lewis Date: Tue, 22 Dec 2020 13:42:37 -0700 Subject: [PATCH 116/173] Add farming tick offset to time tracking plugin --- .../client/plugins/timetracking/Tab.java | 3 +- .../timetracking/TimeTrackingConfig.java | 2 + .../timetracking/TimeTrackingPanel.java | 19 +- .../timetracking/TimeTrackingPlugin.java | 42 ++-- .../farming/FarmingContractManager.java | 4 +- .../farming/FarmingNextTickPanel.java | 107 +++++++++++ .../timetracking/farming/FarmingRegion.java | 6 + .../timetracking/farming/FarmingTracker.java | 180 +++++++++++++++--- 8 files changed, 321 insertions(+), 42 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingNextTickPanel.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java index dc9a44a0d1..9637f6524f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java @@ -43,7 +43,8 @@ public enum Tab HOPS("Hops Patches", ItemID.BARLEY), BUSH("Bush Patches", ItemID.POISON_IVY_BERRIES), GRAPE("Grape Patches", ItemID.GRAPES), - SPECIAL("Special Patches", ItemID.MUSHROOM); + SPECIAL("Special Patches", ItemID.MUSHROOM), + TIME_OFFSET("Farming Tick Offset", ItemID.WATERING_CAN); public static final Tab[] FARMING_TABS = {HERB, TREE, FRUIT_TREE, SPECIAL, FLOWER, ALLOTMENT, BUSH, GRAPE, HOPS}; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java index 494320517a..76ceb67bc6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java @@ -33,6 +33,8 @@ import net.runelite.client.config.Units; public interface TimeTrackingConfig extends Config { String CONFIG_GROUP = "timetracking"; + String FARM_TICK_OFFSET = "farmTickOffset"; + String FARM_TICK_OFFSET_PRECISION = "farmTickOffsetPrecision"; String AUTOWEED = "autoweed"; String BIRD_HOUSE = "birdhouse"; String BOTANIST = "botanist"; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java index 9c99ed27cd..990324c93c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java @@ -25,6 +25,8 @@ */ package net.runelite.client.plugins.timetracking; +import com.google.inject.Inject; +import com.google.inject.name.Named; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; @@ -38,16 +40,18 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; -import net.runelite.client.util.AsyncBufferedImage; +import net.runelite.client.config.ConfigManager; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.timetracking.clocks.ClockManager; import net.runelite.client.plugins.timetracking.farming.FarmingContractManager; +import net.runelite.client.plugins.timetracking.farming.FarmingNextTickPanel; import net.runelite.client.plugins.timetracking.farming.FarmingTracker; import net.runelite.client.plugins.timetracking.hunter.BirdHouseTracker; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.PluginPanel; import net.runelite.client.ui.components.materialtabs.MaterialTab; import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; +import net.runelite.client.util.AsyncBufferedImage; class TimeTrackingPanel extends PluginPanel { @@ -64,9 +68,11 @@ class TimeTrackingPanel extends PluginPanel @Nullable private TabContentPanel activeTabPanel = null; - TimeTrackingPanel(ItemManager itemManager, TimeTrackingConfig config, - FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager, - FarmingContractManager farmingContractManager) + @Inject + TimeTrackingPanel(ItemManager itemManager, TimeTrackingConfig config, FarmingTracker farmingTracker, + BirdHouseTracker birdHouseTracker, ClockManager clockManager, + FarmingContractManager farmingContractManager, ConfigManager configManager, + @Named("developerMode") boolean developerMode) { super(false); @@ -93,6 +99,11 @@ class TimeTrackingPanel extends PluginPanel { addTab(tab, farmingTracker.createTabPanel(tab, farmingContractManager)); } + + if (developerMode) + { + addTab(Tab.TIME_OFFSET, new FarmingNextTickPanel(farmingTracker, config, configManager)); + } } private void addTab(Tab tab, TabContentPanel tabContentPanel) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java index 55ff192afd..e77843bcdc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java @@ -25,6 +25,7 @@ */ package net.runelite.client.plugins.timetracking; +import com.google.inject.Inject; import com.google.inject.Provides; import java.awt.image.BufferedImage; import java.time.Instant; @@ -32,20 +33,21 @@ import java.time.temporal.ChronoUnit; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import javax.inject.Inject; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.coords.WorldPoint; -import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.CommandExecuted; import net.runelite.api.events.GameTick; +import net.runelite.api.events.WidgetClosed; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetModalMode; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.RuneScapeProfileChanged; -import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.CONFIG_GROUP; @@ -88,18 +90,15 @@ public class TimeTrackingPlugin extends Plugin @Inject private ClockManager clockManager; - @Inject - private ItemManager itemManager; - - @Inject - private TimeTrackingConfig config; - @Inject private InfoBoxManager infoBoxManager; @Inject private ScheduledExecutorService executorService; + @Inject + private ConfigManager configManager; + private ScheduledFuture panelUpdateFuture; private TimeTrackingPanel panel; @@ -109,6 +108,8 @@ public class TimeTrackingPlugin extends Plugin private WorldPoint lastTickLocation; private boolean lastTickPostLogin; + private int lastModalCloseTick = 0; + @Provides TimeTrackingConfig provideConfig(ConfigManager configManager) { @@ -125,7 +126,7 @@ public class TimeTrackingPlugin extends Plugin final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "watch.png"); - panel = new TimeTrackingPanel(itemManager, config, farmingTracker, birdHouseTracker, clockManager, farmingContractManager); + panel = injector.getInstance(TimeTrackingPanel.class); navButton = NavigationButton.builder() .tooltip("Time Tracking") @@ -174,6 +175,16 @@ public class TimeTrackingPlugin extends Plugin } } + @Subscribe + public void onCommandExecuted(CommandExecuted commandExecuted) + { + if (commandExecuted.getCommand().equals("resetfarmtick")) + { + configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION); + configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET); + } + } + @Subscribe public void onGameTick(GameTick t) { @@ -206,7 +217,7 @@ public class TimeTrackingPlugin extends Plugin } boolean birdHouseDataChanged = birdHouseTracker.updateData(loc); - boolean farmingDataChanged = farmingTracker.updateData(loc); + boolean farmingDataChanged = farmingTracker.updateData(loc, client.getTickCount() - lastModalCloseTick); boolean farmingContractDataChanged = farmingContractManager.updateData(loc); if (birdHouseDataChanged || farmingDataChanged || farmingContractDataChanged) @@ -235,6 +246,15 @@ public class TimeTrackingPlugin extends Plugin farmingContractManager.setContract(null); } + @Subscribe + private void onWidgetClosed(WidgetClosed ev) + { + if (ev.getModalMode() != WidgetModalMode.NON_MODAL) + { + lastModalCloseTick = client.getTickCount(); + } + } + @Schedule(period = 10, unit = ChronoUnit.SECONDS) public void checkCompletion() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java index e2b411733f..99f8599a95 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingContractManager.java @@ -25,6 +25,7 @@ */ package net.runelite.client.plugins.timetracking.farming; +import com.google.inject.Singleton; import java.time.Instant; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,6 +48,7 @@ import net.runelite.client.plugins.timetracking.TimeTrackingPlugin; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.Text; +@Singleton public class FarmingContractManager { private static final int GUILDMASTER_JANE_NPC_ID = NullNpcID.NULL_8628; @@ -264,7 +266,7 @@ public class FarmingContractManager continue; } - if ((contract.requiresHealthCheck() && state == CropState.HARVESTABLE) + if ((contract.getPatchImplementation().isHealthCheckRequired() && state == CropState.HARVESTABLE) && !(hasEmptyPatch || hasDiseasedPatch || hasDeadPatch)) { summary = SummaryState.OCCUPIED; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingNextTickPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingNextTickPanel.java new file mode 100644 index 0000000000..100de2194d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingNextTickPanel.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2020 Morgan Lewis + * 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.timetracking.farming; + +import com.google.inject.Inject; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import javax.swing.JTextArea; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.plugins.timetracking.TabContentPanel; +import net.runelite.client.plugins.timetracking.TimeTrackingConfig; +import net.runelite.client.plugins.timetracking.TimeablePanel; +import net.runelite.client.ui.ColorScheme; + +public class FarmingNextTickPanel extends TabContentPanel +{ + private final FarmingTracker farmingTracker; + private final TimeTrackingConfig config; + private final ConfigManager configManager; + private final List> patchPanels; + private final JTextArea infoTextArea; + + @Inject + public FarmingNextTickPanel( + FarmingTracker farmingTracker, + TimeTrackingConfig config, + ConfigManager configManager + ) + { + this.farmingTracker = farmingTracker; + this.config = config; + this.configManager = configManager; + this.patchPanels = new ArrayList<>(); + + setLayout(new GridBagLayout()); + setBackground(ColorScheme.DARK_GRAY_COLOR); + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.gridx = 0; + c.gridy = 0; + + int[] times = {5, 10, 20, 40, 80, 160, 320, 640}; + + for (int time : times) + { + TimeablePanel panel = new TimeablePanel<>(null, time + " minute tick", time); + patchPanels.add(panel); + add(panel, c); + c.gridy++; + } + + infoTextArea = new JTextArea(); + add(infoTextArea, c); + c.gridy++; + } + + @Override + public int getUpdateInterval() + { + return 50; + } + + @Override + public void update() + { + long unixNow = Instant.now().getEpochSecond(); + + for (TimeablePanel panel : patchPanels) + { + int tickLength = panel.getProgress().getMaximumValue(); + long nextTick = farmingTracker.getTickTime(tickLength, 1); + panel.getEstimate().setText(getFormattedEstimate(nextTick - unixNow, config.timeFormatMode())); + } + + String offsetPrecisionMins = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION); + String offsetTimeMins = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET); + + infoTextArea.setText("Offset precision:" + offsetPrecisionMins + "\nFarming tick offset: -" + offsetTimeMins); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java index c768d30c14..a759d2c31b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java @@ -54,4 +54,10 @@ public class FarmingRegion { return true; } + + @Override + public String toString() + { + return name; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java index 298e91a5ce..409ee85e1d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java @@ -27,20 +27,24 @@ package net.runelite.client.plugins.timetracking.farming; import com.google.inject.Inject; import com.google.inject.Singleton; import java.time.Instant; +import java.util.Collection; import java.util.EnumMap; import java.util.Map; import java.util.Set; import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.Varbits; import net.runelite.api.coords.WorldPoint; import net.runelite.api.vars.Autoweed; +import net.runelite.api.widgets.WidgetModalMode; import net.runelite.client.config.ConfigManager; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.timetracking.SummaryState; import net.runelite.client.plugins.timetracking.Tab; import net.runelite.client.plugins.timetracking.TimeTrackingConfig; +@Slf4j @Singleton public class FarmingTracker { @@ -58,9 +62,11 @@ public class FarmingTracker */ private final Map completionTimes = new EnumMap<>(Tab.class); + private boolean newRegionLoaded; + private Collection lastRegions; + @Inject - private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager, - TimeTrackingConfig config, FarmingWorld farmingWorld) + private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager, TimeTrackingConfig config, FarmingWorld farmingWorld) { this.client = client; this.itemManager = itemManager; @@ -69,7 +75,6 @@ public class FarmingTracker this.farmingWorld = farmingWorld; } - public FarmingTabPanel createTabPanel(Tab tab, FarmingContractManager farmingContractManager) { return new FarmingTabPanel(this, itemManager, config, farmingWorld.getTabs().get(tab), farmingContractManager); @@ -78,10 +83,18 @@ public class FarmingTracker /** * Updates tracker data for the current region. Returns true if any data was changed. */ - public boolean updateData(WorldPoint location) + public boolean updateData(WorldPoint location, int timeSinceModalClose) { boolean changed = false; + //Varbits don't get sent when a modal widget is open so just return + if (client.getComponentTable().getNodes() + .stream() + .anyMatch(widgetNode -> widgetNode.getModalMode() != WidgetModalMode.NON_MODAL)) + { + return false; + } + { String autoweed = Integer.toString(client.getVar(Varbits.AUTOWEED)); if (!autoweed.equals(configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.AUTOWEED))) @@ -100,13 +113,16 @@ public class FarmingTracker } } - for (FarmingRegion region : farmingWorld.getRegions().get(location.getRegionID())) - { - if (!region.isInBounds(location)) - { - continue; - } + Collection newRegions = farmingWorld.getRegionsForLocation(location); + if (!newRegions.equals(lastRegions)) + { + newRegionLoaded = true; + log.debug("New region loaded. {} at {} ticks", newRegions.toString(), client.getTickCount()); + } + + for (FarmingRegion region : newRegions) + { // Write config with new varbits // timetracking...=: long unixNow = Instant.now().getEpochSecond(); @@ -121,20 +137,62 @@ public class FarmingTracker if (storedValue != null) { String[] parts = storedValue.split(":"); - if (parts.length == 2 && parts[0].equals(strVarbit)) + if (parts.length == 2) { - long unixTime = 0; - try + if (parts[0].equals(strVarbit)) { - unixTime = Long.parseLong(parts[1]); + long unixTime = 0; + try + { + unixTime = Long.parseLong(parts[1]); + } + catch (NumberFormatException e) + { + // ignored + } + if (unixTime + (5 * 60) > unixNow && unixNow + 30 > unixTime) + { + continue; + } } - catch (NumberFormatException e) + else if (!newRegionLoaded && timeSinceModalClose > 1) { - // ignored + PatchState previousPatchState = patch.getImplementation().forVarbitValue(Integer.parseInt(parts[0])); + PatchState currentPatchState = patch.getImplementation().forVarbitValue(client.getVar(varbit)); + + if (previousPatchState == null || currentPatchState == null) + { + continue; + } + + int patchTickRate = previousPatchState.getTickRate(); + + if (isObservedGrowthTick(previousPatchState, currentPatchState)) + { + Integer storedOffsetPrecision = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION, int.class); + Integer storedOffsetMins = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET, int.class); + + int offsetMins = (int) Math.abs(((Instant.now().getEpochSecond() / 60) % patchTickRate) - patchTickRate); + log.debug("Observed an exact growth tick. Offset is: {} from a {} minute tick", offsetMins, patchTickRate); + + if (storedOffsetMins != null && storedOffsetMins != 0 && offsetMins != storedOffsetMins % patchTickRate) + { + WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); + log.error("Offset error! Observed new offset of {}, previous observed offset was {} ({}) Player Loc:{}", offsetMins, storedOffsetMins, storedOffsetMins % patchTickRate, playerLocation); + } + + if (storedOffsetPrecision == null || patchTickRate >= storedOffsetPrecision) + { + log.debug("Found a longer growth tick {}, saving new offset", patchTickRate); + + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION, patchTickRate); + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET, offsetMins); + } + } } - if (unixTime + (5 * 60) > unixNow && unixNow + 30 > unixTime) + else { - continue; + log.debug("ignoring growth tick for offset calculation; newRegionLoaded={} timeSinceModalClose={}", newRegionLoaded, timeSinceModalClose); } } } @@ -145,6 +203,10 @@ public class FarmingTracker } } + //Do one scan after loading a new region before possibly updating tick offsets + newRegionLoaded = false; + lastRegions = newRegions; + if (changed) { updateCompletionTime(); @@ -153,6 +215,47 @@ public class FarmingTracker return changed; } + private boolean isObservedGrowthTick(PatchState previous, PatchState current) + { + //Check the previous state so it will still calculate during the final growth tick + int patchTickRate = previous.getTickRate(); + CropState previousCropState = previous.getCropState(); + CropState currentCropState = current.getCropState(); + Produce previousProduce = previous.getProduce(); + + //Ignore weeds growing or being cleared. + if (previousProduce == Produce.WEEDS || current.getProduce() == Produce.WEEDS + || current.getProduce() != previousProduce + || patchTickRate <= 0) + { + return false; + } + + if (previousCropState == CropState.GROWING) + { + if ((currentCropState == CropState.GROWING && current.getStage() - previous.getStage() == 1) + || currentCropState == CropState.DISEASED) + { + log.debug("Found GROWING -> GROWING or GROWING -> DISEASED"); + return true; + } + + if (currentCropState == CropState.HARVESTABLE && !previousProduce.getPatchImplementation().isHealthCheckRequired()) + { + log.debug("Found GROWING -> HARVESTABLE"); + return true; + } + } + + if (previousCropState == CropState.DISEASED && currentCropState == CropState.DEAD) + { + log.debug("Found DISEASED -> DEAD"); + return true; + } + + return false; + } + @Nullable public PatchPrediction predictPatch(FarmingPatch patch) { @@ -203,8 +306,7 @@ public class FarmingTracker int stage = state.getStage(); int stages = state.getStages(); - int tickrate = state.getTickRate() * 60; - int farmingTickLength = 5 * 60; + int tickrate = state.getTickRate(); if (autoweed && state.getProduce() == Produce.WEEDS) { @@ -216,17 +318,16 @@ public class FarmingTracker if (botanist) { tickrate /= 5; - farmingTickLength /= 5; } long doneEstimate = 0; if (tickrate > 0) { - long tickNow = (unixNow + farmingTickLength) / tickrate; - long tickTime = (unixTime + farmingTickLength) / tickrate; - int delta = (int) (tickNow - tickTime); + long tickNow = getTickTime(tickrate, 0, unixNow); + long tickTime = getTickTime(tickrate, 0, unixTime); + int delta = (int) (tickNow - tickTime) / (tickrate * 60); - doneEstimate = ((stages - 1 - stage) + tickTime) * tickrate + farmingTickLength; + doneEstimate = getTickTime(tickrate, stages - 1 - stage, tickTime); stage += delta; if (stage >= stages) @@ -244,10 +345,39 @@ public class FarmingTracker ); } + public long getTickTime(int tickRate, int ticks) + { + return getTickTime(tickRate, ticks, Instant.now().getEpochSecond()); + } + + public long getTickTime(int tickRate, int ticks, long requestedTime) + { + Integer offsetPrecisionMins = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET_PRECISION, int.class); + Integer offsetTimeMins = configManager.getRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.FARM_TICK_OFFSET, int.class); + + //All offsets are negative but are stored as positive + long calculatedOffsetTime = 0L; + if (offsetPrecisionMins != null && offsetTimeMins != null && (offsetPrecisionMins >= tickRate || offsetPrecisionMins >= 40)) + { + calculatedOffsetTime = (offsetTimeMins % tickRate) * 60; + } + + //Calculate "now" as +offset seconds in the future so we calculate the correct ticks + long unixNow = requestedTime + calculatedOffsetTime; + + //The time that the tick requested will happen + long timeOfCurrentTick = (unixNow - (unixNow % (tickRate * 60))); + long timeOfGoalTick = timeOfCurrentTick + (ticks * tickRate * 60); + + //Move ourselves back to real time + return timeOfGoalTick - calculatedOffsetTime; + } + public void loadCompletionTimes() { summaries.clear(); completionTimes.clear(); + lastRegions = null; updateCompletionTime(); } From e69a854a7edffa45ce64837f41c320464366dd50 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Mon, 28 Dec 2020 10:55:40 -0500 Subject: [PATCH 117/173] menu entry swapper: add dwarven rock cake swap --- .../menuentryswapper/MenuEntrySwapperConfig.java | 11 +++++++++++ .../menuentryswapper/MenuEntrySwapperPlugin.java | 2 ++ 2 files changed, 13 insertions(+) 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 21116633b3..dda54b3c21 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 @@ -606,4 +606,15 @@ public interface MenuEntrySwapperConfig extends Config { return false; } + + @ConfigItem( + keyName = "swapRockCake", + name = "Dwarven rock cake", + description = "Swap Eat with Guzzle on the Dwarven rock cake", + section = itemSection + ) + default boolean swapRockCake() + { + return false; + } } 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 fd60d7eef2..e9caec7980 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 @@ -355,6 +355,8 @@ public class MenuEntrySwapperPlugin extends Plugin swapTeleport("camelot teleport", "seers'"); swapTeleport("watchtower teleport", "yanille"); swapTeleport("teleport to house", "outside"); + + swap("eat", "guzzle", config::swapRockCake); } private void swap(String option, String swappedOption, Supplier enabled) From 5822e489f713d15f3a826801d34d82440f4a177f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 27 Dec 2020 19:16:48 -0500 Subject: [PATCH 118/173] Allow mouse tooltips on the welcome screen and full screen world map Adjust the mouse highlight overlay to run at the same layers as the tooltip overlay. It always runs first due to having a lower position. I think previously tooltips from ui ops were 1 frame behind due to this being UNDER_WIDGETS. Additionally change the tooltip overlay to draw after the fullscreen tli instead of the world map interface. Having it render after the world map caused tooltips to render after the floating world map too, which is too early. The fullscreen tli is the root of both the fullscreen world map and of the welcome screen. --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 2 +- .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 2 -- .../client/plugins/devtools/WidgetInspectorOverlay.java | 2 +- .../client/plugins/mousehighlight/MouseHighlightOverlay.java | 4 ++++ .../runelite/client/ui/overlay/tooltip/TooltipOverlay.java | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index c2a61de5e4..cf5597004c 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -131,7 +131,7 @@ public class WidgetID public static final int LOOTING_BAG_GROUP_ID = 81; public static final int SKOTIZO_GROUP_ID = 308; public static final int ENTERING_HOUSE_GROUP_ID = 71; - public static final int FULLSCREEN_MAP_GROUP_ID = 165; + public static final int FULLSCREEN_CONTAINER_TLI = 165; public static final int QUESTLIST_GROUP_ID = 399; public static final int SKILLS_GROUP_ID = 320; public static final int MUSIC_GROUP_ID = 239; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 50bc1d2171..486bd504e1 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -518,8 +518,6 @@ public enum WidgetInfo SKOTIZO_CONTAINER(WidgetID.SKOTIZO_GROUP_ID, WidgetID.Skotizo.CONTAINER), - FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_MAP_GROUP_ID, WidgetID.FullScreenMap.ROOT), - QUESTLIST_BOX(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.BOX), QUESTLIST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.CONTAINER), QUESTLIST_SCROLLBAR(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.SCROLLBAR), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java index 27b83f0f2a..bd89bd90c5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java @@ -62,7 +62,7 @@ public class WidgetInspectorOverlay extends Overlay setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_WIDGETS); setPriority(OverlayPriority.HIGHEST); - drawAfterInterface(WidgetID.FULLSCREEN_MAP_GROUP_ID); + drawAfterInterface(WidgetID.FULLSCREEN_CONTAINER_TLI); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java index be6001241d..1e56b743eb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java @@ -37,6 +37,7 @@ import net.runelite.api.VarClientInt; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; 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.tooltip.Tooltip; import net.runelite.client.ui.overlay.tooltip.TooltipManager; @@ -80,6 +81,9 @@ class MouseHighlightOverlay extends Overlay MouseHighlightOverlay(Client client, TooltipManager tooltipManager, MouseHighlightConfig config) { setPosition(OverlayPosition.DYNAMIC); + setLayer(OverlayLayer.ABOVE_WIDGETS); + // additionally allow tooltips above the full screen world map and welcome screen + drawAfterInterface(WidgetID.FULLSCREEN_CONTAINER_TLI); this.client = client; this.tooltipManager = tooltipManager; this.config = config; diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java index 002af12c34..81a1142e08 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/tooltip/TooltipOverlay.java @@ -61,8 +61,8 @@ public class TooltipOverlay extends Overlay setPosition(OverlayPosition.TOOLTIP); setPriority(OverlayPriority.HIGHEST); setLayer(OverlayLayer.ABOVE_WIDGETS); - // additionally allow tooltips above the world map - drawAfterInterface(WidgetID.WORLD_MAP_GROUP_ID); + // additionally allow tooltips above the full screen world map and welcome screen + drawAfterInterface(WidgetID.FULLSCREEN_CONTAINER_TLI); } @Override From 68f4174b2129a2726321f888bd863971932e9b0d Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Dec 2020 13:54:30 -0500 Subject: [PATCH 119/173] comp_unordered.glsl: don't orient vertices While nothing passed to comp_unordered uses orientation, the uniform block is not bound in this shader, and rotate() accesses sinCosTable. So I'm not sure why this has ever worked. --- .../runelite/client/plugins/gpu/comp_unordered.glsl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl index 531eb6c935..8eb4bdaa69 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl @@ -29,8 +29,6 @@ layout(local_size_x = 6) in; -#include common.glsl - void main() { uint groupId = gl_WorkGroupID.x; uint localId = gl_LocalInvocationID.x; @@ -41,7 +39,6 @@ void main() { int outOffset = minfo.idx; int uvOffset = minfo.uvOffset; int flags = minfo.flags; - int orientation = flags & 0x7ff; ivec4 pos = ivec4(minfo.x, minfo.y, minfo.z, 0); if (localId >= size) { @@ -62,16 +59,12 @@ void main() { thisC = tempvb[offset + ssboOffset * 3 + 2]; } - ivec4 thisrvA = rotate(thisA, orientation); - ivec4 thisrvB = rotate(thisB, orientation); - ivec4 thisrvC = rotate(thisC, orientation); - uint myOffset = localId; // position vertices in scene and write to out buffer - vout[outOffset + myOffset * 3] = pos + thisrvA; - vout[outOffset + myOffset * 3 + 1] = pos + thisrvB; - vout[outOffset + myOffset * 3 + 2] = pos + thisrvC; + vout[outOffset + myOffset * 3] = pos + thisA; + vout[outOffset + myOffset * 3 + 1] = pos + thisB; + vout[outOffset + myOffset * 3 + 2] = pos + thisC; if (uvOffset < 0) { uvout[outOffset + myOffset * 3] = vec4(0, 0, 0, 0); From 14ada669f522b0968795556abf86735de9b86c91 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 29 Dec 2020 18:06:29 -0500 Subject: [PATCH 120/173] gpu: move calculateExtreme() after visibility check It is only used in the clickbox code and isn't required for isVisible() --- .../java/net/runelite/client/plugins/gpu/GpuPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 67b2c1bcc1..e7d3bb50ab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -1450,13 +1450,13 @@ public class GpuPlugin extends Plugin implements DrawCallbacks if (model != null) { model.calculateBoundsCylinder(); - model.calculateExtreme(orientation); if (!isVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) { return; } + model.calculateExtreme(orientation); client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash); modelX = x + client.getCameraX2(); @@ -1480,13 +1480,13 @@ public class GpuPlugin extends Plugin implements DrawCallbacks Model model = (Model) renderable; model.calculateBoundsCylinder(); - model.calculateExtreme(orientation); if (!isVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) { return; } + model.calculateExtreme(orientation); client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash); int tc = Math.min(MAX_TRIANGLE, model.getTrianglesCount()); @@ -1515,13 +1515,13 @@ public class GpuPlugin extends Plugin implements DrawCallbacks model.setModelHeight(model.getModelHeight()); model.calculateBoundsCylinder(); - model.calculateExtreme(orientation); if (!isVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) { return; } + model.calculateExtreme(orientation); client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash); boolean hasUv = model.getFaceTextures() != null; From 5c5e71681a8d7c311affb24695ef7c0a7a8b7657 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 29 Dec 2020 18:21:25 -0500 Subject: [PATCH 121/173] gpu: correctly set model height on non-model renderables This was incorrect before, but I think is only used for determining if a renderable is occluded, and doesn't change any behaviors I can see --- .../net/runelite/client/plugins/gpu/GpuPlugin.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index e7d3bb50ab..2d3b0c78d4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -1449,6 +1449,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks Model model = renderable instanceof Model ? (Model) renderable : renderable.getModel(); if (model != null) { + // Apply height to renderable from the model + if (model != renderable) + { + renderable.setModelHeight(model.getModelHeight()); + } + model.calculateBoundsCylinder(); if (!isVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) @@ -1512,7 +1518,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks if (model != null) { // Apply height to renderable from the model - model.setModelHeight(model.getModelHeight()); + if (model != renderable) + { + renderable.setModelHeight(model.getModelHeight()); + } model.calculateBoundsCylinder(); From 246b0f8a863d3e1973628c2ef58f967a32ec5c87 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Dec 2020 20:52:49 -0500 Subject: [PATCH 122/173] gpu: draw full screen widgets on gpu This adjusts the draw callbacks api to take in the color of the full screen overlay the client would have rendered. This is primarily used in godwars, underwater, darkmeyer, etc. Having them rasterized on the cpu is slow, especially with gpu on since we additionally have to compute the alpha per-pixel. --- .../net/runelite/api/hooks/DrawCallbacks.java | 7 ++++++- .../runelite/client/plugins/gpu/GpuPlugin.java | 18 +++++++++++++----- .../runelite/client/plugins/gpu/fragui.glsl | 11 +++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java b/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java index 989cc45dd2..7cf7469f37 100644 --- a/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java +++ b/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java @@ -43,7 +43,12 @@ public interface DrawCallbacks SceneTileModel model, int tileZ, int tileX, int tileY, int zoom, int centerX, int centerY); - void draw(); + /** + * Called when a frame should be drawn. + * + * @param overlayColor Color of full-viewport overlays, if any + */ + void draw(int overlayColor); boolean drawFace(Model model, int face); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 2d3b0c78d4..e82373edd5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -264,6 +264,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks private int uniTexSamplingMode; private int uniTexSourceDimensions; private int uniTexTargetDimensions; + private int uniUiAlphaOverlay; private int uniTextures; private int uniTextureOffsets; private int uniBlockSmall; @@ -545,6 +546,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks uniTexTargetDimensions = gl.glGetUniformLocation(glUiProgram, "targetDimensions"); uniTexSourceDimensions = gl.glGetUniformLocation(glUiProgram, "sourceDimensions"); uniUiColorBlindMode = gl.glGetUniformLocation(glUiProgram, "colorBlindMode"); + uniUiAlphaOverlay = gl.glGetUniformLocation(glUiProgram, "alphaOverlay"); uniTextures = gl.glGetUniformLocation(glProgram, "textures"); uniTextureOffsets = gl.glGetUniformLocation(glProgram, "textureOffsets"); @@ -855,9 +857,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks } @Override - public void draw() + public void draw(int overlayColor) { - invokeOnMainThread(this::drawFrame); + invokeOnMainThread(() -> drawFrame(overlayColor)); } private void resize(int canvasWidth, int canvasHeight, int viewportWidth, int viewportHeight) @@ -883,7 +885,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks } } - private void drawFrame() + private void drawFrame(int overlayColor) { if (jawtWindow.getAWTComponent() != client.getCanvas()) { @@ -1208,7 +1210,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks tempUvOffset = 0; // Texture on UI - drawUi(canvasHeight, canvasWidth); + drawUi(overlayColor, canvasHeight, canvasWidth); glDrawable.swapBuffers(); @@ -1226,7 +1228,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks }; } - private void drawUi(final int canvasHeight, final int canvasWidth) + private void drawUi(final int overlayColor, final int canvasHeight, final int canvasWidth) { final BufferProvider bufferProvider = client.getBufferProvider(); final int[] pixels = bufferProvider.getPixels(); @@ -1254,6 +1256,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks gl.glUniform1i(uniTexSamplingMode, uiScalingMode.getMode()); gl.glUniform2i(uniTexSourceDimensions, canvasWidth, canvasHeight); gl.glUniform1i(uniUiColorBlindMode, config.colorBlindMode().ordinal()); + gl.glUniform4f(uniUiAlphaOverlay, + (overlayColor >> 16 & 0xFF) / 255f, + (overlayColor >> 8 & 0xFF) / 255f, + (overlayColor & 0xFF) / 255f, + (overlayColor >>> 24) / 255f + ); if (client.isStretchedEnabled()) { diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl index e522d34400..5a54522f83 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl @@ -34,6 +34,7 @@ uniform int samplingMode; uniform ivec2 sourceDimensions; uniform ivec2 targetDimensions; uniform int colorBlindMode; +uniform vec4 alphaOverlay; #include scale/bicubic.glsl #include scale/xbr_lv2_frag.glsl @@ -44,6 +45,13 @@ in XBRTable xbrTable; out vec4 FragColor; +vec4 alphaBlend(vec4 src, vec4 dst) { + return vec4( + src.rgb + dst.rgb * (1.0f - src.a), + src.a + dst.a * (1.0f - src.a) + ); +} + void main() { vec4 c; @@ -51,14 +59,17 @@ void main() { case SAMPLING_CATROM: case SAMPLING_MITCHELL: c = textureCubic(tex, TexCoord, samplingMode); + c = alphaBlend(c, alphaOverlay); c.rgb = colorblind(colorBlindMode, c.rgb); break; case SAMPLING_XBR: c = textureXBR(tex, TexCoord, xbrTable, ceil(1.0 * targetDimensions.x / sourceDimensions.x)); + c = alphaBlend(c, alphaOverlay); c.rgb = colorblind(colorBlindMode, c.rgb); break; default: // NEAREST or LINEAR, which uses GL_TEXTURE_MIN_FILTER/GL_TEXTURE_MAG_FILTER to affect sampling c = texture(tex, TexCoord); + c = alphaBlend(c, alphaOverlay); c.rgb = colorblind(colorBlindMode, c.rgb); } From fd9626495bcb0b3dfd768e617964dfe1a067893e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 30 Dec 2020 14:31:42 -0500 Subject: [PATCH 123/173] client: bind runelite.properties to guice --- .../java/net/runelite/client/Notifier.java | 9 ++-- .../net/runelite/client/RuneLiteModule.java | 7 +++ .../runelite/client/RuneLiteProperties.java | 45 ++----------------- .../client/discord/DiscordService.java | 10 +++-- .../ChatNotificationsPlugin.java | 8 +++- .../client/plugins/discord/DiscordPlugin.java | 8 +++- .../client/plugins/discord/DiscordState.java | 18 ++++++-- .../client/plugins/info/InfoPanel.java | 31 ++++++++++--- .../java/net/runelite/client/ui/ClientUI.java | 17 ++++--- .../runelite/client/util/ImageCapture.java | 26 +++++++---- .../net/runelite/client/runelite.properties | 1 - .../ChatNotificationsPluginTest.java | 5 +++ .../plugins/discord/DiscordStateTest.java | 9 ++++ .../screenshot/ScreenshotPluginTest.java | 5 +++ 14 files changed, 122 insertions(+), 77 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index 872866c415..8184cf9f98 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -45,6 +45,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import javax.inject.Named; import javax.inject.Singleton; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; @@ -101,8 +102,6 @@ public class Notifier private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000; private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH; - private static final String appName = RuneLiteProperties.getTitle(); - private static final File NOTIFICATION_FILE = new File(RuneLite.RUNELITE_DIR, "notification.wav"); private static final long CLIP_MTIME_UNLOADED = -2; private static final long CLIP_MTIME_BUILTIN = -1; @@ -113,6 +112,7 @@ public class Notifier private final ScheduledExecutorService executorService; private final ChatMessageManager chatMessageManager; private final EventBus eventBus; + private final String appName; private final Path notifyIconPath; private boolean terminalNotifierAvailable; private Instant flashStart; @@ -127,7 +127,9 @@ public class Notifier final RuneLiteConfig runeliteConfig, final ScheduledExecutorService executorService, final ChatMessageManager chatMessageManager, - final EventBus eventBus) + final EventBus eventBus, + @Named("runelite.title") final String appName + ) { this.client = client; this.clientUI = clientUI; @@ -135,6 +137,7 @@ public class Notifier this.executorService = executorService; this.chatMessageManager = chatMessageManager; this.eventBus = eventBus; + this.appName = appName; this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png"); // First check if we are running in launcher diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java b/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java index 517a7f83e0..3376c62f77 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java @@ -29,6 +29,7 @@ import com.google.inject.Provides; import com.google.inject.name.Names; import java.applet.Applet; import java.io.File; +import java.util.Properties; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.function.Supplier; @@ -66,6 +67,12 @@ public class RuneLiteModule extends AbstractModule @Override protected void configure() { + Properties properties = RuneLiteProperties.getProperties(); + for (String key : properties.stringPropertyNames()) + { + String value = properties.getProperty(key); + bindConstant().annotatedWith(Names.named(key)).to(value); + } bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode); bindConstant().annotatedWith(Names.named("safeMode")).to(safeMode); bind(File.class).annotatedWith(Names.named("sessionfile")).toInstance(sessionfile); diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java b/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java index ab0911c1f4..2be480f85e 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLiteProperties.java @@ -28,18 +28,14 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; import javax.annotation.Nullable; +import lombok.AccessLevel; +import lombok.Getter; import okhttp3.HttpUrl; public class RuneLiteProperties { - private static final String RUNELITE_TITLE = "runelite.title"; private static final String RUNELITE_VERSION = "runelite.version"; - private static final String RUNESCAPE_VERSION = "runescape.version"; - private static final String DISCORD_APP_ID = "runelite.discord.appid"; private static final String DISCORD_INVITE = "runelite.discord.invite"; - private static final String GITHUB_LINK = "runelite.github.link"; - private static final String WIKI_LINK = "runelite.wiki.link"; - private static final String PATREON_LINK = "runelite.patreon.link"; private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version"; private static final String INSECURE_SKIP_TLS_VERIFICATION_PROPERTY = "runelite.insecure-skip-tls-verification"; private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link"; @@ -49,8 +45,8 @@ public class RuneLiteProperties private static final String JAV_CONFIG_BACKUP = "runelite.jav_config_backup"; private static final String PLUGINHUB_BASE = "runelite.pluginhub.url"; private static final String PLUGINHUB_VERSION = "runelite.pluginhub.version"; - private static final String IMGUR_CLIENT_ID = "runelite.imgur.client.id"; + @Getter(AccessLevel.PACKAGE) private static final Properties properties = new Properties(); static @@ -65,46 +61,16 @@ public class RuneLiteProperties } } - public static String getTitle() - { - return properties.getProperty(RUNELITE_TITLE); - } - public static String getVersion() { return properties.getProperty(RUNELITE_VERSION); } - public static String getRunescapeVersion() - { - return properties.getProperty(RUNESCAPE_VERSION); - } - - public static String getDiscordAppId() - { - return properties.getProperty(DISCORD_APP_ID); - } - public static String getDiscordInvite() { return properties.getProperty(DISCORD_INVITE); } - public static String getGithubLink() - { - return properties.getProperty(GITHUB_LINK); - } - - public static String getWikiLink() - { - return properties.getProperty(WIKI_LINK); - } - - public static String getPatreonLink() - { - return properties.getProperty(PATREON_LINK); - } - @Nullable public static String getLauncherVersion() { @@ -146,9 +112,4 @@ public class RuneLiteProperties String version = System.getProperty(PLUGINHUB_VERSION, properties.getProperty(PLUGINHUB_VERSION)); return HttpUrl.parse(properties.get(PLUGINHUB_BASE) + "/" + version); } - - public static String getImgurClientId() - { - return properties.getProperty(IMGUR_CLIENT_ID); - } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java index cf2a16fd37..cc6ebe3b10 100644 --- a/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java +++ b/runelite-client/src/main/java/net/runelite/client/discord/DiscordService.java @@ -28,10 +28,10 @@ import com.google.common.base.Strings; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.runelite.client.RuneLiteProperties; import net.runelite.client.discord.events.DiscordDisconnected; import net.runelite.client.discord.events.DiscordErrored; import net.runelite.client.discord.events.DiscordJoinGame; @@ -50,6 +50,7 @@ public class DiscordService implements AutoCloseable { private final EventBus eventBus; private final ScheduledExecutorService executorService; + private final String discordAppId; private final DiscordRPC discordRPC; // Hold a reference to the event handlers to prevent the garbage collector from deleting them @@ -61,11 +62,14 @@ public class DiscordService implements AutoCloseable @Inject private DiscordService( final EventBus eventBus, - final ScheduledExecutorService executorService) + final ScheduledExecutorService executorService, + @Named("runelite.discord.appid") final String discordAppId + ) { this.eventBus = eventBus; this.executorService = executorService; + this.discordAppId = discordAppId; DiscordRPC discordRPC = null; DiscordEventHandlers discordEventHandlers = null; @@ -103,7 +107,7 @@ public class DiscordService implements AutoCloseable discordEventHandlers.joinGame = this::joinGame; discordEventHandlers.spectateGame = this::spectateGame; discordEventHandlers.joinRequest = this::joinRequest; - discordRPC.Discord_Initialize(RuneLiteProperties.getDiscordAppId(), discordEventHandlers, true, null); + discordRPC.Discord_Initialize(discordAppId, discordEventHandlers, true, null); executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java index 44069b177d..4ccfd1925e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java @@ -34,13 +34,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.inject.Inject; +import javax.inject.Named; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.MessageNode; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; import net.runelite.client.Notifier; -import net.runelite.client.RuneLiteProperties; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; @@ -70,6 +70,10 @@ public class ChatNotificationsPlugin extends Plugin @Inject private Notifier notifier; + @Inject + @Named("runelite.title") + private String runeliteTitle; + //Custom Highlights private Pattern usernameMatcher = null; private String usernameReplacer = ""; @@ -163,7 +167,7 @@ public class ChatNotificationsPlugin extends Plugin break; case CONSOLE: // Don't notify for notification messages - if (chatMessage.getName().equals(RuneLiteProperties.getTitle())) + if (chatMessage.getName().equals(runeliteTitle)) { return; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index f4cdaa34a5..7b00cc11e8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -37,6 +37,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; import javax.imageio.ImageIO; +import javax.inject.Named; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -46,7 +47,6 @@ import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.StatChanged; import net.runelite.api.events.VarbitChanged; -import net.runelite.client.RuneLiteProperties; import net.runelite.client.config.ConfigManager; import net.runelite.client.discord.DiscordService; import net.runelite.client.discord.events.DiscordJoinGame; @@ -106,6 +106,10 @@ public class DiscordPlugin extends Plugin @Inject private OkHttpClient okHttpClient; + @Inject + @Named("runelite.discord.invite") + private String discordInvite; + private final Map skillExp = new HashMap<>(); private NavigationButton discordButton; private boolean loginFlag; @@ -125,7 +129,7 @@ public class DiscordPlugin extends Plugin .tab(false) .tooltip("Join Discord") .icon(icon) - .onClick(() -> LinkBrowser.browse(RuneLiteProperties.getDiscordInvite())) + .onClick(() -> LinkBrowser.browse(discordInvite)) .build(); clientToolbar.addNavigation(discordButton); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java index 671107833e..f311511d26 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java @@ -35,8 +35,8 @@ import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; import javax.inject.Inject; +import javax.inject.Named; import lombok.Data; -import net.runelite.client.RuneLiteProperties; import net.runelite.client.discord.DiscordPresence; import net.runelite.client.discord.DiscordService; import net.runelite.client.ws.PartyService; @@ -60,14 +60,24 @@ class DiscordState private final DiscordService discordService; private final DiscordConfig config; private final PartyService party; + private final String runeliteTitle; + private final String runeliteVersion; private DiscordPresence lastPresence; @Inject - private DiscordState(final DiscordService discordService, final DiscordConfig config, final PartyService party) + private DiscordState( + final DiscordService discordService, + final DiscordConfig config, + final PartyService party, + @Named("runelite.title") final String runeliteTitle, + @Named("runelite.version") final String runeliteVersion + ) { this.discordService = discordService; this.config = config; this.party = party; + this.runeliteTitle = runeliteTitle; + this.runeliteVersion = runeliteVersion; } /** @@ -188,12 +198,12 @@ class DiscordState } // Replace snapshot with + to make tooltip shorter (so it will span only 1 line) - final String versionShortHand = RuneLiteProperties.getVersion().replace("-SNAPSHOT", "+"); + final String versionShortHand = runeliteVersion.replace("-SNAPSHOT", "+"); final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() .state(MoreObjects.firstNonNull(state, "")) .details(MoreObjects.firstNonNull(details, "")) - .largeImageText(RuneLiteProperties.getTitle() + " v" + versionShortHand) + .largeImageText(runeliteTitle + " v" + versionShortHand) .smallImageKey(imageKey) .partyMax(PARTY_MAX) .partySize(party.getMembers().size()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index d691cef668..b9eb0fd2e8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -36,6 +36,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; +import javax.inject.Named; import javax.inject.Singleton; import javax.swing.Box; import javax.swing.ImageIcon; @@ -91,6 +92,26 @@ public class InfoPanel extends PluginPanel @Inject private ConfigManager configManager; + @Inject + @Named("runelite.version") + private String runeliteVersion; + + @Inject + @Named("runelite.github.link") + private String githubLink; + + @Inject + @Named("runelite.discord.invite") + private String discordInvite; + + @Inject + @Named("runelite.patreon.link") + private String patreonLink; + + @Inject + @Named("runelite.wiki.link") + private String wikiLink; + static { ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png")); @@ -114,7 +135,7 @@ public class InfoPanel extends PluginPanel final Font smallFont = FontManager.getRunescapeSmallFont(); - JLabel version = new JLabel(htmlLabel("RuneLite version: ", RuneLiteProperties.getVersion())); + JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeliteVersion)); version.setFont(smallFont); JLabel revision = new JLabel(); @@ -173,10 +194,10 @@ public class InfoPanel extends PluginPanel } }); - actionsContainer.add(buildLinkPanel(GITHUB_ICON, "Report an issue or", "make a suggestion", RuneLiteProperties.getGithubLink())); - actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "Discord server", RuneLiteProperties.getDiscordInvite())); - actionsContainer.add(buildLinkPanel(PATREON_ICON, "Become a patron to", "help support RuneLite", RuneLiteProperties.getPatreonLink())); - actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", RuneLiteProperties.getWikiLink())); + actionsContainer.add(buildLinkPanel(GITHUB_ICON, "Report an issue or", "make a suggestion", githubLink)); + actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "Discord server", discordInvite)); + actionsContainer.add(buildLinkPanel(PATREON_ICON, "Become a patron to", "help support RuneLite", patreonLink)); + actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", wikiLink)); add(versionPanel, BorderLayout.NORTH); add(actionsContainer, BorderLayout.CENTER); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index fdde73c995..8e19ddcf1a 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -71,7 +71,6 @@ import net.runelite.api.Point; import net.runelite.api.events.GameStateChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.RuneLiteProperties; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ExpandResizeType; @@ -122,6 +121,7 @@ public class ClientUI private final Provider clientThreadProvider; private final EventBus eventBus; private final boolean safeMode; + private final String title; private final CardLayout cardLayout = new CardLayout(); private final Rectangle sidebarButtonPosition = new Rectangle(); @@ -151,7 +151,9 @@ public class ClientUI ConfigManager configManager, Provider clientThreadProvider, EventBus eventBus, - @Named("safeMode") boolean safeMode) + @Named("safeMode") boolean safeMode, + @Named("runelite.title") String title + ) { this.config = config; this.keyManager = keyManager; @@ -161,6 +163,7 @@ public class ClientUI this.clientThreadProvider = clientThreadProvider; this.eventBus = eventBus; this.safeMode = safeMode; + this.title = title; } @Subscribe @@ -293,7 +296,7 @@ public class ClientUI return false; } - frame.setTitle(RuneLiteProperties.getTitle() + " - " + name); + frame.setTitle(title + " - " + name); return true; }); } @@ -320,7 +323,7 @@ public class ClientUI // Try to enable fullscreen on OSX OSXUtil.tryEnableFullscreen(frame); - frame.setTitle(RuneLiteProperties.getTitle()); + frame.setTitle(title); frame.setIconImage(ICON); frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing frame.setLocationRelativeTo(frame.getOwner()); @@ -506,7 +509,7 @@ public class ClientUI frame.revalidateMinimumSize(); // Create tray icon (needs to be created after frame is packed) - trayIcon = SwingUtil.createTrayIcon(ICON, RuneLiteProperties.getTitle(), frame); + trayIcon = SwingUtil.createTrayIcon(ICON, title, frame); // Move frame around (needs to be done after frame is packed) if (config.rememberScreenBounds() && !safeMode) @@ -1033,12 +1036,12 @@ public class ClientUI if (player != null && player.getName() != null) { - frame.setTitle(RuneLiteProperties.getTitle() + " - " + player.getName()); + frame.setTitle(title + " - " + player.getName()); } } else { - frame.setTitle(RuneLiteProperties.getTitle()); + frame.setTitle(title); } if (frame.isAlwaysOnTopSupported()) diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageCapture.java b/runelite-client/src/main/java/net/runelite/client/util/ImageCapture.java index ab9f660781..dfee412c03 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ImageCapture.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ImageCapture.java @@ -45,6 +45,7 @@ import java.util.EnumSet; import javax.annotation.Nullable; import javax.imageio.ImageIO; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -53,7 +54,6 @@ import net.runelite.api.GameState; import net.runelite.api.WorldType; import net.runelite.client.Notifier; import static net.runelite.client.RuneLite.SCREENSHOT_DIR; -import net.runelite.client.RuneLiteProperties; import net.runelite.http.api.RuneLiteAPI; import okhttp3.Call; import okhttp3.Callback; @@ -72,14 +72,24 @@ public class ImageCapture private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image"); private static final MediaType JSON = MediaType.parse("application/json"); - @Inject - private Client client; + private final Client client; + private final Notifier notifier; + private final OkHttpClient okHttpClient; + private final String imgurClientId; @Inject - private Notifier notifier; - - @Inject - private OkHttpClient okHttpClient; + private ImageCapture( + final Client client, + final Notifier notifier, + final OkHttpClient okHttpClient, + @Named("runelite.imgur.client.id") final String imgurClientId + ) + { + this.client = client; + this.notifier = notifier; + this.okHttpClient = okHttpClient; + this.imgurClientId = imgurClientId; + } /** * Saves a screenshot of the client window to the screenshot folder as a PNG, @@ -198,7 +208,7 @@ public class ImageCapture Request request = new Request.Builder() .url(IMGUR_IMAGE_UPLOAD_URL) - .addHeader("Authorization", "Client-ID " + RuneLiteProperties.getImgurClientId()) + .addHeader("Authorization", "Client-ID " + imgurClientId) .post(RequestBody.create(JSON, json)) .build(); diff --git a/runelite-client/src/main/resources/net/runelite/client/runelite.properties b/runelite-client/src/main/resources/net/runelite/client/runelite.properties index 1b94eee370..e17aafef18 100644 --- a/runelite-client/src/main/resources/net/runelite/client/runelite.properties +++ b/runelite-client/src/main/resources/net/runelite/client/runelite.properties @@ -1,6 +1,5 @@ runelite.title=RuneLite runelite.version=${project.version} -runescape.version=${rs.version} runelite.discord.appid=409416265891971072 runelite.discord.invite=https://discord.gg/R4BQ8tU runelite.github.link=https://github.com/runelite diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index b341d62de6..69a28f5dc9 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule; import java.util.Iterator; import java.util.List; import javax.inject.Inject; +import javax.inject.Named; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.MessageNode; @@ -67,6 +68,10 @@ public class ChatNotificationsPluginTest @Bind private Notifier notifier; + @Bind + @Named("runelite.title") + private String runeliteTitle = "RuneLite"; + @Inject private ChatNotificationsPlugin chatNotificationsPlugin; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java index 8ce42350e6..815fff0639 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java @@ -31,6 +31,7 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.UUID; import javax.inject.Inject; +import javax.inject.Named; import net.runelite.api.Client; import net.runelite.client.discord.DiscordPresence; import net.runelite.client.discord.DiscordService; @@ -70,6 +71,14 @@ public class DiscordStateTest @Bind PartyService partyService; + @Bind + @Named("runelite.title") + private String runeliteTitle = "RuneLite"; + + @Bind + @Named("runelite.version") + private String runeliteVersion = "version"; + @Before public void before() { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java index 8b3a136ea8..5386db8202 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java @@ -46,6 +46,7 @@ import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.DrawManager; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.ImageCapture; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -110,6 +111,10 @@ public class ScreenshotPluginTest @Bind private InfoBoxManager infoBoxManager; + @Mock + @Bind + private ImageCapture imageCapture; + @Before public void before() { From 0fc1a940887a835df29f3615fbedde15684eed03 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Dec 2020 13:54:44 -0500 Subject: [PATCH 124/173] gpu: dispatch compute after scene draw This moves the compute shaders to run immediately after scene draw, instead of in the draw() callback, which happens much later. All models in the scene have been queued by the time, but since it is so early in the ui drawing, it gives a few more ms for the compute to run before the result needs to be used to draw the next frame. --- .../net/runelite/api/hooks/DrawCallbacks.java | 14 + .../client/plugins/gpu/GpuPlugin.java | 275 ++++++++++-------- 2 files changed, 170 insertions(+), 119 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java b/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java index 7cf7469f37..452480435f 100644 --- a/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java +++ b/runelite-api/src/main/java/net/runelite/api/hooks/DrawCallbacks.java @@ -52,7 +52,21 @@ public interface DrawCallbacks boolean drawFace(Model model, int face); + /** + * Called before the scene is drawn + * @param cameraX + * @param cameraY + * @param cameraZ + * @param cameraPitch + * @param cameraYaw + * @param plane + */ void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane); + /** + * Called after the scene has been drawn + */ + void postDrawScene(); + void animate(Texture texture, int diff); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index e82373edd5..7cbe5f31b0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -242,8 +242,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks private AntiAliasingMode lastAntiAliasingMode; private int lastAnisotropicFilteringLevel = -1; - private int centerX; - private int centerY; private int yaw; private int pitch; // fields for non-compute draw @@ -776,13 +774,149 @@ public class GpuPlugin extends Plugin implements DrawCallbacks @Override public void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane) { - centerX = client.getCenterX(); - centerY = client.getCenterY(); yaw = client.getCameraYaw(); pitch = client.getCameraPitch(); final Scene scene = client.getScene(); scene.setDrawDistance(getDrawDistance()); + + invokeOnMainThread(() -> + { + // UBO. Only the first 32 bytes get modified here, the rest is the constant sin/cos table. + gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, uniformBufferId); + uniformBuffer.clear(); + uniformBuffer + .put(yaw) + .put(pitch) + .put(client.getCenterX()) + .put(client.getCenterY()) + .put(client.getScale()) + .put(client.getCameraX2()) + .put(client.getCameraY2()) + .put(client.getCameraZ2()); + uniformBuffer.flip(); + + gl.glBufferSubData(gl.GL_UNIFORM_BUFFER, 0, uniformBuffer.limit() * Integer.BYTES, uniformBuffer); + gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, 0); + + gl.glBindBufferBase(gl.GL_UNIFORM_BUFFER, 0, uniformBufferId); + }); + } + + @Override + public void postDrawScene() + { + invokeOnMainThread(this::postDraw); + } + + private void postDraw() + { + if (!useComputeShaders) + { + // Upload buffers + vertexBuffer.flip(); + uvBuffer.flip(); + + IntBuffer vertexBuffer = this.vertexBuffer.getBuffer(); + FloatBuffer uvBuffer = this.uvBuffer.getBuffer(); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, vertexBuffer.limit() * Integer.BYTES, vertexBuffer, gl.GL_DYNAMIC_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpUvBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, uvBuffer.limit() * Float.BYTES, uvBuffer, gl.GL_DYNAMIC_DRAW); + + return; + } + + // Upload buffers + vertexBuffer.flip(); + uvBuffer.flip(); + modelBuffer.flip(); + modelBufferSmall.flip(); + modelBufferUnordered.flip(); + + IntBuffer vertexBuffer = this.vertexBuffer.getBuffer(); + FloatBuffer uvBuffer = this.uvBuffer.getBuffer(); + IntBuffer modelBuffer = this.modelBuffer.getBuffer(); + IntBuffer modelBufferSmall = this.modelBufferSmall.getBuffer(); + IntBuffer modelBufferUnordered = this.modelBufferUnordered.getBuffer(); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, vertexBuffer.limit() * Integer.BYTES, vertexBuffer, gl.GL_DYNAMIC_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpUvBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, uvBuffer.limit() * Float.BYTES, uvBuffer, gl.GL_DYNAMIC_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBuffer.limit() * Integer.BYTES, modelBuffer, gl.GL_DYNAMIC_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferSmallId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferSmall.limit() * Integer.BYTES, modelBufferSmall, gl.GL_DYNAMIC_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferUnorderedId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferUnordered.limit() * Integer.BYTES, modelBufferUnordered, gl.GL_DYNAMIC_DRAW); + + // Output buffers + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpOutBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, + targetBufferOffset * 16, // each vertex is an ivec4, which is 16 bytes + null, + gl.GL_STREAM_DRAW); + + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpOutUvBufferId); + gl.glBufferData(gl.GL_ARRAY_BUFFER, + targetBufferOffset * 16, + null, + gl.GL_STREAM_DRAW); + + // Bind UBO to compute programs + gl.glUniformBlockBinding(glSmallComputeProgram, uniBlockSmall, 0); + gl.glUniformBlockBinding(glComputeProgram, uniBlockLarge, 0); + + /* + * Compute is split into three separate programs: 'unordered', 'small', and 'large' + * to save on GPU resources. Small will sort <= 512 faces, large will do <= 4096. + */ + + // unordered + gl.glUseProgram(glUnorderedComputeProgram); + + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferUnorderedId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); + + gl.glDispatchCompute(unorderedModels, 1, 1); + + // small + gl.glUseProgram(glSmallComputeProgram); + + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferSmallId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); + + gl.glDispatchCompute(smallModels, 1, 1); + + // large + gl.glUseProgram(glComputeProgram); + + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); + gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); + + gl.glDispatchCompute(largeModels, 1, 1); } @Override @@ -955,121 +1089,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks gl.glClearColor((sky >> 16 & 0xFF) / 255f, (sky >> 8 & 0xFF) / 255f, (sky & 0xFF) / 255f, 1f); gl.glClear(gl.GL_COLOR_BUFFER_BIT); - // Upload buffers - vertexBuffer.flip(); - uvBuffer.flip(); - modelBuffer.flip(); - modelBufferSmall.flip(); - modelBufferUnordered.flip(); - - IntBuffer vertexBuffer = this.vertexBuffer.getBuffer(); - FloatBuffer uvBuffer = this.uvBuffer.getBuffer(); - IntBuffer modelBuffer = this.modelBuffer.getBuffer(); - IntBuffer modelBufferSmall = this.modelBufferSmall.getBuffer(); - IntBuffer modelBufferUnordered = this.modelBufferUnordered.getBuffer(); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, vertexBuffer.limit() * Integer.BYTES, vertexBuffer, gl.GL_DYNAMIC_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpUvBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, uvBuffer.limit() * Float.BYTES, uvBuffer, gl.GL_DYNAMIC_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBuffer.limit() * Integer.BYTES, modelBuffer, gl.GL_DYNAMIC_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferSmallId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferSmall.limit() * Integer.BYTES, modelBufferSmall, gl.GL_DYNAMIC_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpModelBufferUnorderedId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferUnordered.limit() * Integer.BYTES, modelBufferUnordered, gl.GL_DYNAMIC_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpOutBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, - targetBufferOffset * 16, // each vertex is an ivec4, which is 16 bytes - null, - gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, tmpOutUvBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, - targetBufferOffset * 16, - null, - gl.GL_STREAM_DRAW); - - // UBO. Only the first 32 bytes get modified here, the rest is the constant sin/cos table. - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, uniformBufferId); - uniformBuffer.clear(); - uniformBuffer - .put(yaw) - .put(pitch) - .put(centerX) - .put(centerY) - .put(client.getScale()) - .put(client.getCameraX2()) - .put(client.getCameraY2()) - .put(client.getCameraZ2()); - uniformBuffer.flip(); - - gl.glBufferSubData(gl.GL_UNIFORM_BUFFER, 0, uniformBuffer.limit() * Integer.BYTES, uniformBuffer); - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, 0); - - gl.glBindBufferBase(gl.GL_UNIFORM_BUFFER, 0, uniformBufferId); - // Draw 3d scene final TextureProvider textureProvider = client.getTextureProvider(); if (textureProvider != null) { - if (useComputeShaders) - { - gl.glUniformBlockBinding(glSmallComputeProgram, uniBlockSmall, 0); - gl.glUniformBlockBinding(glComputeProgram, uniBlockLarge, 0); - - /* - * Compute is split into two separate programs 'small' and 'large' to - * save on GPU resources. Small will sort <= 512 faces, large will do <= 4096. - */ - - // unordered - gl.glUseProgram(glUnorderedComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferUnorderedId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); - - gl.glDispatchCompute(unorderedModels, 1, 1); - - // small - gl.glUseProgram(glSmallComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferSmallId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); - - gl.glDispatchCompute(smallModels, 1, 1); - - // large - gl.glUseProgram(glComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, tmpModelBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, tmpBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, tmpOutBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, tmpOutUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, tmpUvBufferId); - - gl.glDispatchCompute(largeModels, 1, 1); - - gl.glMemoryBarrier(gl.GL_SHADER_STORAGE_BARRIER_BIT); - } - if (textureArrayId == -1) { // lazy init textures as they may not be loaded at plugin start. @@ -1168,14 +1191,28 @@ public class GpuPlugin extends Plugin implements DrawCallbacks // Draw buffers gl.glBindVertexArray(vaoHandle); - // When using compute shaders, draw using the output buffer of the compute. Otherwise - // only use the temporary buffers, which will contain the full scene. + int vertexBuffer, uvBuffer; + if (useComputeShaders) + { + // Before reading the SSBOs written to from postDrawScene() we must insert a barrier + gl.glMemoryBarrier(gl.GL_SHADER_STORAGE_BARRIER_BIT); + // Draw using the output buffer of the compute + vertexBuffer = tmpOutBufferId; + uvBuffer = tmpOutUvBufferId; + } + else + { + // Only use the temporary buffers, which will contain the full scene + vertexBuffer = tmpBufferId; + uvBuffer = tmpUvBufferId; + } + gl.glEnableVertexAttribArray(0); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, useComputeShaders ? tmpOutBufferId : tmpBufferId); + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vertexBuffer); gl.glVertexAttribIPointer(0, 4, gl.GL_INT, 0, 0); gl.glEnableVertexAttribArray(1); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, useComputeShaders ? tmpOutUvBufferId : tmpUvBufferId); + gl.glBindBuffer(gl.GL_ARRAY_BUFFER, uvBuffer); gl.glVertexAttribPointer(1, 4, gl.GL_FLOAT, false, 0, 0); gl.glDrawArrays(gl.GL_TRIANGLES, 0, targetBufferOffset); From a26a56fda13a58dfe801fd5e58980d7b7d40e43d Mon Sep 17 00:00:00 2001 From: dekvall Date: Tue, 10 Nov 2020 05:47:10 +0100 Subject: [PATCH 125/173] sponsors: add patreon link --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..ffe3444e96 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +patreon: runelite From d3372e0255d7e7aed2a5f9c75ab39103405a2313 Mon Sep 17 00:00:00 2001 From: Usman Akhtar <60450353+akhtar-u@users.noreply.github.com> Date: Wed, 30 Dec 2020 23:56:04 -0500 Subject: [PATCH 126/173] menu entry swapper: fix swap for sedridor --- .../client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fd60d7eef2..3ac2489645 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 @@ -125,7 +125,7 @@ public class MenuEntrySwapperPlugin extends Plugin private static final Set ESSENCE_MINE_NPCS = ImmutableSet.of( "aubury", - "wizard sedridor", + "sedridor", "wizard distentor", "wizard cromperty", "brimstail" From 92207c82109c3bcbe43f43eb1f55867458d61384 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Wed, 30 Dec 2020 23:14:33 -0700 Subject: [PATCH 127/173] ImageUtil: rename getResourceStreamFromClass to loadImageResource --- .../runelite/client/game/SkillIconManager.java | 2 +- .../net/runelite/client/game/SpriteManager.java | 2 +- .../client/plugins/account/AccountPlugin.java | 4 ++-- .../BarbarianAssaultPlugin.java | 2 +- .../client/plugins/boosts/BoostsPlugin.java | 4 ++-- .../plugins/cluescrolls/ClueScrollPlugin.java | 4 ++-- .../client/plugins/config/ConfigPanel.java | 4 ++-- .../client/plugins/config/ConfigPlugin.java | 2 +- .../client/plugins/config/PluginHubPanel.java | 6 +++--- .../client/plugins/config/PluginListItem.java | 4 ++-- .../plugins/config/PluginToggleButton.java | 2 +- .../plugins/customcursor/CustomCursor.java | 2 +- .../client/plugins/devtools/DevToolsPanel.java | 2 +- .../client/plugins/devtools/DevToolsPlugin.java | 2 +- .../client/plugins/discord/DiscordPlugin.java | 2 +- .../runelite/client/plugins/emojis/Emoji.java | 2 +- .../runelite/client/plugins/feed/FeedPanel.java | 4 ++-- .../client/plugins/feed/FeedPlugin.java | 2 +- .../plugins/friendnotes/FriendNotesPlugin.java | 2 +- .../grandexchange/GrandExchangeOfferSlot.java | 2 +- .../grandexchange/GrandExchangePlugin.java | 2 +- .../client/plugins/hiscore/HiscorePanel.java | 4 ++-- .../client/plugins/hiscore/HiscorePlugin.java | 2 +- .../runelite/client/plugins/info/InfoPanel.java | 12 ++++++------ .../client/plugins/info/InfoPlugin.java | 2 +- .../interfacestyles/InterfaceStylesPlugin.java | 2 +- .../kourendlibrary/KourendLibraryPanel.java | 2 +- .../kourendlibrary/KourendLibraryPlugin.java | 2 +- .../plugins/loginscreen/LoginScreenPlugin.java | 2 +- .../plugins/loottracker/LootTrackerPanel.java | 14 +++++++------- .../plugins/loottracker/LootTrackerPlugin.java | 2 +- .../plugins/mta/alchemy/AlchemyRoomTimer.java | 2 +- .../client/plugins/notes/NotesPlugin.java | 2 +- .../plugins/party/PartyWorldMapPoint.java | 2 +- .../runelite/client/plugins/poh/PohIcons.java | 2 +- .../client/plugins/poison/PoisonPlugin.java | 6 +++--- .../client/plugins/prayer/PrayerBarOverlay.java | 4 ++-- .../screenmarkers/ScreenMarkerPlugin.java | 2 +- .../ui/ScreenMarkerCreationPanel.java | 4 ++-- .../screenmarkers/ui/ScreenMarkerPanel.java | 12 ++++++------ .../ui/ScreenMarkerPluginPanel.java | 2 +- .../plugins/screenshot/ScreenshotPlugin.java | 2 +- .../skillcalculator/SkillCalculatorPlugin.java | 2 +- .../plugins/statusbars/StatusBarsOverlay.java | 6 +++--- .../plugins/timetracking/OverviewItemPanel.java | 2 +- .../timetracking/TimeTrackingPlugin.java | 2 +- .../timetracking/clocks/ClockTabPanel.java | 16 ++++++++-------- .../plugins/worldhopper/WorldTableHeader.java | 2 +- .../plugins/worldhopper/WorldTableRow.java | 8 ++++---- .../worldmap/RunecraftingAltarPoint.java | 2 +- .../client/plugins/worldmap/TeleportPoint.java | 2 +- .../client/plugins/worldmap/WorldMapPlugin.java | 14 +++++++------- .../plugins/xptracker/XpTrackerPlugin.java | 2 +- .../java/net/runelite/client/ui/ClientUI.java | 4 ++-- .../runelite/client/ui/FatalErrorDialog.java | 2 +- .../net/runelite/client/ui/SplashScreen.java | 2 +- .../net/runelite/client/util/ImageUtil.java | 17 +++++++++++++---- 57 files changed, 117 insertions(+), 108 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java b/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java index 6a7311bea1..187a936dac 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/SkillIconManager.java @@ -49,7 +49,7 @@ public class SkillIconManager String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/") + skill.getName().toLowerCase() + ".png"; log.debug("Loading skill icon from {}", skillIconPath); - BufferedImage skillImage = ImageUtil.getResourceStreamFromClass(getClass(), skillIconPath); + BufferedImage skillImage = ImageUtil.loadImageResource(getClass(), skillIconPath); imgCache[skillIdx] = skillImage; return skillImage; diff --git a/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java b/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java index 3d7271af7f..7c0bd4f2fc 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/SpriteManager.java @@ -162,7 +162,7 @@ public class SpriteManager Class owner = add[0].getClass(); for (SpriteOverride o : add) { - BufferedImage image = ImageUtil.getResourceStreamFromClass(owner, o.getFileName()); + BufferedImage image = ImageUtil.loadImageResource(owner, o.getFileName()); SpritePixels sp = ImageUtil.getImageSpritePixels(image, client); overrides.put(o.getSpriteId(), sp); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java index 901987356c..501537654e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java @@ -65,8 +65,8 @@ public class AccountPlugin extends Plugin static { - LOGIN_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "login_icon.png"); - LOGOUT_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "logout_icon.png"); + LOGIN_IMAGE = ImageUtil.loadImageResource(AccountPlugin.class, "login_icon.png"); + LOGOUT_IMAGE = ImageUtil.loadImageResource(AccountPlugin.class, "logout_icon.png"); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java index 73eb79037d..61db1d7cf9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java @@ -100,7 +100,7 @@ public class BarbarianAssaultPlugin extends Plugin overlayManager.add(timerOverlay); overlayManager.add(healerOverlay); - clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png"); + clockImage = ImageUtil.loadImageResource(getClass(), "clock.png"); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java index c9fd49c97b..dac873dbf7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java @@ -119,8 +119,8 @@ public class BoostsPlugin extends Plugin Arrays.fill(lastSkillLevels, -1); // Add infoboxes for everything at startup and then determine inside if it will be rendered - infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.getResourceStreamFromClass(getClass(), "debuffed.png"), this, config)); - infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.getResourceStreamFromClass(getClass(), "buffed.png"), this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.loadImageResource(getClass(), "debuffed.png"), this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.loadImageResource(getClass(), "buffed.png"), this, config)); for (final Skill skill : Skill.values()) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java index 1cca0adfb3..06dee6142a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java @@ -625,7 +625,7 @@ public class ClueScrollPlugin extends Plugin return emoteImage; } - emoteImage = ImageUtil.getResourceStreamFromClass(getClass(), "emote.png"); + emoteImage = ImageUtil.loadImageResource(getClass(), "emote.png"); return emoteImage; } @@ -642,7 +642,7 @@ public class ClueScrollPlugin extends Plugin return mapArrow; } - mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png"); + mapArrow = ImageUtil.loadImageResource(getClass(), "/util/clue_arrow.png"); return mapArrow; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 278864ea15..fe6a5b54a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -134,11 +134,11 @@ class ConfigPanel extends PluginPanel static { - final BufferedImage backIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_back_icon.png"); + final BufferedImage backIcon = ImageUtil.loadImageResource(ConfigPanel.class, "config_back_icon.png"); BACK_ICON = new ImageIcon(backIcon); BACK_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(backIcon, -100)); - BufferedImage sectionRetractIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "/util/arrow_right.png"); + BufferedImage sectionRetractIcon = ImageUtil.loadImageResource(ConfigPanel.class, "/util/arrow_right.png"); sectionRetractIcon = ImageUtil.luminanceOffset(sectionRetractIcon, -121); SECTION_EXPAND_ICON = new ImageIcon(sectionRetractIcon); SECTION_EXPAND_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(sectionRetractIcon, -100)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java index ac93dcf96b..41372e3895 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java @@ -83,7 +83,7 @@ public class ConfigPlugin extends Plugin )); pluginListPanel.rebuildPluginList(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "config_icon.png"); navButton = NavigationButton.builder() .tooltip("Configuration") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java index 978be1b4c5..562a8517e2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java @@ -102,14 +102,14 @@ class PluginHubPanel extends PluginPanel static { - BufferedImage missingIcon = ImageUtil.getResourceStreamFromClass(PluginHubPanel.class, "pluginhub_missingicon.png"); + BufferedImage missingIcon = ImageUtil.loadImageResource(PluginHubPanel.class, "pluginhub_missingicon.png"); MISSING_ICON = new ImageIcon(missingIcon); - BufferedImage helpIcon = ImageUtil.getResourceStreamFromClass(PluginHubPanel.class, "pluginhub_help.png"); + BufferedImage helpIcon = ImageUtil.loadImageResource(PluginHubPanel.class, "pluginhub_help.png"); HELP_ICON = new ImageIcon(helpIcon); HELP_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(helpIcon, -100)); - BufferedImage configureIcon = ImageUtil.getResourceStreamFromClass(PluginHubPanel.class, "pluginhub_configure.png"); + BufferedImage configureIcon = ImageUtil.loadImageResource(PluginHubPanel.class, "pluginhub_configure.png"); CONFIGURE_ICON = new ImageIcon(configureIcon); CONFIGURE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(configureIcon, -100)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java index c71bcc8788..767fddbc1a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java @@ -73,8 +73,8 @@ class PluginListItem extends JPanel implements SearchablePlugin static { - BufferedImage configIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_edit_icon.png"); - BufferedImage onStar = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "star_on.png"); + BufferedImage configIcon = ImageUtil.loadImageResource(ConfigPanel.class, "config_edit_icon.png"); + BufferedImage onStar = ImageUtil.loadImageResource(ConfigPanel.class, "star_on.png"); CONFIG_ICON = new ImageIcon(configIcon); ON_STAR = new ImageIcon(onStar); CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(configIcon, -100)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java index a2eb72719f..8de213ec56 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java @@ -39,7 +39,7 @@ class PluginToggleButton extends JToggleButton static { - BufferedImage onSwitcher = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "switcher_on.png"); + BufferedImage onSwitcher = ImageUtil.loadImageResource(ConfigPanel.class, "switcher_on.png"); ON_SWITCHER = new ImageIcon(onSwitcher); OFF_SWITCHER = new ImageIcon(ImageUtil.flipImage( ImageUtil.luminanceScale( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java index 37208ddd23..3baf137c96 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java @@ -54,6 +54,6 @@ public enum CustomCursor CustomCursor(String name, String icon) { this.name = name; - this.cursorImage = ImageUtil.getResourceStreamFromClass(CustomCursorPlugin.class, icon); + this.cursorImage = ImageUtil.loadImageResource(CustomCursorPlugin.class, icon); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java index 7ee247f92c..abc63546d9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java @@ -174,7 +174,7 @@ class DevToolsPanel extends PluginPanel final JButton newInfoboxBtn = new JButton("Infobox"); newInfoboxBtn.addActionListener(e -> { - Counter counter = new Counter(ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"), plugin, 42) + Counter counter = new Counter(ImageUtil.loadImageResource(getClass(), "devtools_icon.png"), plugin, 42) { @Override public String getName() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java index df0b342c3b..424c26e4c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java @@ -198,7 +198,7 @@ public class DevToolsPlugin extends Plugin final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "devtools_icon.png"); navButton = NavigationButton.builder() .tooltip("Developer Tools") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index 7b00cc11e8..6f5ffbdcd1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -123,7 +123,7 @@ public class DiscordPlugin extends Plugin @Override protected void startUp() throws Exception { - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "discord.png"); discordButton = NavigationButton.builder() .tab(false) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java b/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java index acee57ab0f..37cc934ce2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java @@ -116,7 +116,7 @@ enum Emoji BufferedImage loadImage() { - return ImageUtil.getResourceStreamFromClass(getClass(), this.name().toLowerCase() + ".png"); + return ImageUtil.loadImageResource(getClass(), this.name().toLowerCase() + ".png"); } static Emoji getEmoji(String trigger) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java index 7b1d987c4e..66894b3cda 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java @@ -101,8 +101,8 @@ class FeedPanel extends PluginPanel static { - RUNELITE_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "runelite.png")); - OSRS_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "osrs.png")); + RUNELITE_ICON = new ImageIcon(ImageUtil.loadImageResource(FeedPanel.class, "runelite.png")); + OSRS_ICON = new ImageIcon(ImageUtil.loadImageResource(FeedPanel.class, "osrs.png")); } private final FeedConfig config; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java index 5cc4ea0bd9..ebe607d986 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java @@ -97,7 +97,7 @@ public class FeedPlugin extends Plugin { feedPanel = injector.getInstance(FeedPanel.class); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "icon.png"); navButton = NavigationButton.builder() .tooltip("News Feed") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java index 94fe830cc1..55183e9dff 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java @@ -416,7 +416,7 @@ public class FriendNotesPlugin extends Plugin return; } - final BufferedImage iconImg = ImageUtil.getResourceStreamFromClass(getClass(), "note_icon.png"); + final BufferedImage iconImg = ImageUtil.loadImageResource(getClass(), "note_icon.png"); if (iconImg == null) { return; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java index 13405426b9..ab9a04f5c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java @@ -82,7 +82,7 @@ public class GrandExchangeOfferSlot extends JPanel static { - final BufferedImage rightArrow = ImageUtil.alphaOffset(ImageUtil.getResourceStreamFromClass(GrandExchangeOfferSlot.class, "/util/arrow_right.png"), 0.25f); + final BufferedImage rightArrow = ImageUtil.alphaOffset(ImageUtil.loadImageResource(GrandExchangeOfferSlot.class, "/util/arrow_right.png"), 0.25f); RIGHT_ARROW_ICON = new ImageIcon(rightArrow); LEFT_ARROW_ICON = new ImageIcon(ImageUtil.flipImage(rightArrow, true, false)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index 4e7886292e..d28f4b0323 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -289,7 +289,7 @@ public class GrandExchangePlugin extends Plugin { panel = injector.getInstance(GrandExchangePanel.class); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "ge_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "ge_icon.png"); button = NavigationButton.builder() .tooltip("Grand Exchange") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index 7876289da6..3da379b2f7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -206,7 +206,7 @@ public class HiscorePanel extends PluginPanel for (HiscoreEndpoint endpoint : ENDPOINTS) { - final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), endpoint.name().toLowerCase() + ".png"); + final BufferedImage iconImage = ImageUtil.loadImageResource(getClass(), endpoint.name().toLowerCase() + ".png"); MaterialTab tab = new MaterialTab(new ImageIcon(iconImage), tabGroup, null); tab.setToolTipText(endpoint.getName() + " Hiscores"); @@ -345,7 +345,7 @@ public class HiscorePanel extends PluginPanel String skillIcon = directory + skillName + ".png"; log.debug("Loading skill icon from {}", skillIcon); - label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon))); + label.setIcon(new ImageIcon(ImageUtil.loadImageResource(getClass(), skillIcon))); boolean totalLabel = skill == OVERALL || skill == null; //overall or combat label.setIconTextGap(totalLabel ? 10 : 4); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java index 75e41f6018..edb450d61b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java @@ -94,7 +94,7 @@ public class HiscorePlugin extends Plugin { hiscorePanel = injector.getInstance(HiscorePanel.class); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "normal.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "normal.png"); navButton = NavigationButton.builder() .tooltip("Hiscore") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index b9eb0fd2e8..c59fa78798 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -114,12 +114,12 @@ public class InfoPanel extends PluginPanel static { - ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png")); - GITHUB_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "github_icon.png")); - DISCORD_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "discord_icon.png")); - PATREON_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "patreon_icon.png")); - WIKI_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "wiki_icon.png")); - IMPORT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "import_icon.png")); + ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "/util/arrow_right.png")); + GITHUB_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "github_icon.png")); + DISCORD_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "discord_icon.png")); + PATREON_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "patreon_icon.png")); + WIKI_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "wiki_icon.png")); + IMPORT_ICON = new ImageIcon(ImageUtil.loadImageResource(InfoPanel.class, "import_icon.png")); } void init() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java index f986a28ffa..6b85037e67 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPlugin.java @@ -50,7 +50,7 @@ public class InfoPlugin extends Plugin final InfoPanel panel = injector.getInstance(InfoPanel.class); panel.init(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "info_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "info_icon.png"); navButton = NavigationButton.builder() .tooltip("Info") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index 48ee9313fa..f224fa55f7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -264,7 +264,7 @@ public class InterfaceStylesPlugin extends Plugin try { log.debug("Loading: {}", file); - BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), file); + BufferedImage image = ImageUtil.loadImageResource(this.getClass(), file); return ImageUtil.getImageSpritePixels(image, client); } catch (RuntimeException ex) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java index 73d5a1937f..513127a248 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java @@ -59,7 +59,7 @@ class KourendLibraryPanel extends PluginPanel static { - final BufferedImage resetIcon = ImageUtil.getResourceStreamFromClass(KourendLibraryPanel.class, "/util/reset.png"); + final BufferedImage resetIcon = ImageUtil.loadImageResource(KourendLibraryPanel.class, "/util/reset.png"); RESET_ICON = new ImageIcon(resetIcon); RESET_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(resetIcon, -100)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java index d0bd3c11cf..b79ee73720 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java @@ -134,7 +134,7 @@ public class KourendLibraryPlugin extends Plugin panel = injector.getInstance(KourendLibraryPanel.class); panel.init(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "panel_icon.png"); navButton = NavigationButton.builder() .tooltip("Kourend Library") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java index e338af7fe6..a4ede4f9dc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java @@ -308,7 +308,7 @@ public class LoginScreenPlugin extends Plugin implements KeyListener try { log.debug("Loading: {}", file); - BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), file); + BufferedImage image = ImageUtil.loadImageResource(this.getClass(), file); return ImageUtil.getImageSpritePixels(image, client); } catch (RuntimeException ex) 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 f90563954a..cb4802cdaf 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 @@ -131,13 +131,13 @@ class LootTrackerPanel extends PluginPanel static { - final BufferedImage singleLootImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "single_loot_icon.png"); - final BufferedImage groupedLootImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "grouped_loot_icon.png"); - final BufferedImage backArrowImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "back_icon.png"); - final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "visible_icon.png"); - final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "invisible_icon.png"); - final BufferedImage collapseImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "collapsed.png"); - final BufferedImage expandedImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "expanded.png"); + final BufferedImage singleLootImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "single_loot_icon.png"); + final BufferedImage groupedLootImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "grouped_loot_icon.png"); + final BufferedImage backArrowImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "back_icon.png"); + final BufferedImage visibleImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "visible_icon.png"); + final BufferedImage invisibleImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "invisible_icon.png"); + final BufferedImage collapseImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "collapsed.png"); + final BufferedImage expandedImg = ImageUtil.loadImageResource(LootTrackerPlugin.class, "expanded.png"); SINGLE_LOOT_VIEW = new ImageIcon(singleLootImg); SINGLE_LOOT_VIEW_FADED = new ImageIcon(ImageUtil.alphaOffset(singleLootImg, -180)); 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 ed085b081c..6f8c1d966d 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 @@ -363,7 +363,7 @@ public class LootTrackerPlugin extends Plugin panel = new LootTrackerPanel(this, itemManager, config); spriteManager.getSpriteAsync(SpriteID.TAB_INVENTORY, 0, panel::loadHeaderIcon); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "panel_icon.png"); navButton = NavigationButton.builder() .tooltip("Loot Tracker") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java index 3292fc4392..a28dbedc97 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java @@ -48,7 +48,7 @@ public class AlchemyRoomTimer extends Timer return image; } - image = ImageUtil.getResourceStreamFromClass(AlchemyRoomTimer.class, "/util/reset.png"); + image = ImageUtil.loadImageResource(AlchemyRoomTimer.class, "/util/reset.png"); return image; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java index 0b23ac8eb2..92afc38378 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java @@ -65,7 +65,7 @@ public class NotesPlugin extends Plugin panel = injector.getInstance(NotesPanel.class); panel.init(config); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "notes_icon.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "notes_icon.png"); navButton = NavigationButton.builder() .tooltip("Notes") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java index 79608ac725..f892560501 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java @@ -34,7 +34,7 @@ import net.runelite.client.ws.PartyMember; class PartyWorldMapPoint extends WorldMapPoint { - private static final BufferedImage ARROW = ImageUtil.getResourceStreamFromClass(PartyWorldMapPoint.class, "/util/clue_arrow.png"); + private static final BufferedImage ARROW = ImageUtil.loadImageResource(PartyWorldMapPoint.class, "/util/clue_arrow.png"); private BufferedImage partyImage; private final PartyMember member; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java index 01925a7aab..418ce28ef6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java @@ -143,7 +143,7 @@ public enum PohIcons return image; } - image = ImageUtil.getResourceStreamFromClass(getClass(), getImageResource() + ".png"); + image = ImageUtil.loadImageResource(getClass(), getImageResource() + ".png"); return image; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java index 22386a90ba..cf26835e83 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java @@ -71,9 +71,9 @@ public class PoisonPlugin extends Plugin static { - HEART_DISEASE = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.DISEASE_HEART), 26, 26); - HEART_POISON = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.POISON_HEART), 26, 26); - HEART_VENOM = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.VENOM_HEART), 26, 26); + HEART_DISEASE = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.DISEASE_HEART), 26, 26); + HEART_POISON = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.POISON_HEART), 26, 26); + HEART_VENOM = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.VENOM_HEART), 26, 26); } @Inject diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java index 522c1aa754..5d84ac22f3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java @@ -52,8 +52,8 @@ class PrayerBarOverlay extends Overlay private static final Color FLICK_HELP_COLOR = Color.white; private static final Dimension PRAYER_BAR_SIZE = new Dimension(30, 5); private static final int HD_PRAYER_BAR_PADDING = 1; - private static final BufferedImage HD_FRONT_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "front.png"); - private static final BufferedImage HD_BACK_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "back.png"); + private static final BufferedImage HD_FRONT_BAR = ImageUtil.loadImageResource(PrayerPlugin.class, "front.png"); + private static final BufferedImage HD_BACK_BAR = ImageUtil.loadImageResource(PrayerPlugin.class, "back.png"); private final Client client; private final PrayerConfig config; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java index 6dc7558df2..88dca9d214 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java @@ -125,7 +125,7 @@ public class ScreenMarkerPlugin extends Plugin pluginPanel = new ScreenMarkerPluginPanel(this); pluginPanel.rebuild(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), ICON_FILE); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), ICON_FILE); navigationButton = NavigationButton.builder() .tooltip(PLUGIN_NAME) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java index 51567dd2dc..b5a1ddd7e8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java @@ -54,8 +54,8 @@ public class ScreenMarkerCreationPanel extends JPanel static { - CONFIRM_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "confirm_icon.png")); - CANCEL_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "cancel_icon.png")); + CONFIRM_ICON = new ImageIcon(ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "confirm_icon.png")); + CANCEL_ICON = new ImageIcon(ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "cancel_icon.png")); final BufferedImage confirmIcon = ImageUtil.bufferedImageFromImage(CONFIRM_ICON.getImage()); CONFIRM_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(confirmIcon, 0.54f)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java index 782697f396..a9ad6e61e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java @@ -107,7 +107,7 @@ class ScreenMarkerPanel extends JPanel static { - final BufferedImage borderImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "border_color_icon.png"); + final BufferedImage borderImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "border_color_icon.png"); final BufferedImage borderImgHover = ImageUtil.luminanceOffset(borderImg, -150); BORDER_COLOR_ICON = new ImageIcon(borderImg); BORDER_COLOR_HOVER_ICON = new ImageIcon(borderImgHover); @@ -115,7 +115,7 @@ class ScreenMarkerPanel extends JPanel NO_BORDER_COLOR_ICON = new ImageIcon(borderImgHover); NO_BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(borderImgHover, -100)); - final BufferedImage fillImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "fill_color_icon.png"); + final BufferedImage fillImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "fill_color_icon.png"); final BufferedImage fillImgHover = ImageUtil.luminanceOffset(fillImg, -150); FILL_COLOR_ICON = new ImageIcon(fillImg); FILL_COLOR_HOVER_ICON = new ImageIcon(fillImgHover); @@ -123,7 +123,7 @@ class ScreenMarkerPanel extends JPanel NO_FILL_COLOR_ICON = new ImageIcon(fillImgHover); NO_FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(fillImgHover, -100)); - final BufferedImage opacityImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "opacity_icon.png"); + final BufferedImage opacityImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "opacity_icon.png"); final BufferedImage opacityImgHover = ImageUtil.luminanceOffset(opacityImg, -150); FULL_OPACITY_ICON = new ImageIcon(opacityImg); FULL_OPACITY_HOVER_ICON = new ImageIcon(opacityImgHover); @@ -131,15 +131,15 @@ class ScreenMarkerPanel extends JPanel NO_OPACITY_ICON = new ImageIcon(opacityImgHover); NO_OPACITY_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImgHover, -100)); - final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "visible_icon.png"); + final BufferedImage visibleImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "visible_icon.png"); VISIBLE_ICON = new ImageIcon(visibleImg); VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100)); - final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "invisible_icon.png"); + final BufferedImage invisibleImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "invisible_icon.png"); INVISIBLE_ICON = new ImageIcon(invisibleImg); INVISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -100)); - final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "delete_icon.png"); + final BufferedImage deleteImg = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "delete_icon.png"); DELETE_ICON = new ImageIcon(deleteImg); DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java index d63a2af4d4..efa012df87 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java @@ -77,7 +77,7 @@ public class ScreenMarkerPluginPanel extends PluginPanel static { - final BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "add_icon.png"); + final BufferedImage addIcon = ImageUtil.loadImageResource(ScreenMarkerPlugin.class, "add_icon.png"); ADD_ICON = new ImageIcon(addIcon); ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f)); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java index 7ecc64af50..b199248c39 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java @@ -186,7 +186,7 @@ public class ScreenshotPlugin extends Plugin SCREENSHOT_DIR.mkdirs(); keyManager.registerKeyListener(hotkeyListener); - final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), "screenshot.png"); + final BufferedImage iconImage = ImageUtil.loadImageResource(getClass(), "screenshot.png"); titleBarButton = NavigationButton.builder() .tab(false) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java index 1deb71d093..8999d2ad00 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java @@ -64,7 +64,7 @@ public class SkillCalculatorPlugin extends Plugin @Override protected void startUp() throws Exception { - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "calc.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "calc.png"); final SkillCalculatorPanel uiPanel = new SkillCalculatorPanel(skillIconManager, client, spriteManager, itemManager); uiNavigationButton = NavigationButton.builder() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java index 55a9603d6a..3710944577 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java @@ -311,9 +311,9 @@ class StatusBarsOverlay extends Overlay } heartIcon = ImageUtil.resizeCanvas(Objects.requireNonNull(spriteManager.getSprite(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, 0)), ICON_DIMENSIONS, ICON_DIMENSIONS); - heartDisease = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.DISEASE_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); - heartPoison = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.POISON_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); - heartVenom = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(AlternateSprites.class, AlternateSprites.VENOM_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); + heartDisease = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.DISEASE_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); + heartPoison = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.POISON_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); + heartVenom = ImageUtil.resizeCanvas(ImageUtil.loadImageResource(AlternateSprites.class, AlternateSprites.VENOM_HEART), ICON_DIMENSIONS, ICON_DIMENSIONS); energyIcon = ImageUtil.resizeCanvas(Objects.requireNonNull(spriteManager.getSprite(SpriteID.MINIMAP_ORB_WALK_ICON, 0)), ICON_DIMENSIONS, ICON_DIMENSIONS); specialIcon = ImageUtil.resizeCanvas(Objects.requireNonNull(spriteManager.getSprite(SpriteID.MINIMAP_ORB_SPECIAL_ICON, 0)), ICON_DIMENSIONS, ICON_DIMENSIONS); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java index a029d0b5d9..56776f272f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java @@ -57,7 +57,7 @@ class OverviewItemPanel extends JPanel static { - ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "/util/arrow_right.png")); + ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "/util/arrow_right.png")); } OverviewItemPanel(ItemManager itemManager, TimeTrackingPanel pluginPanel, Tab tab, String title) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java index e77843bcdc..0f6f3c30f1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java @@ -124,7 +124,7 @@ public class TimeTrackingPlugin extends Plugin birdHouseTracker.loadFromConfig(); farmingTracker.loadCompletionTimes(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "watch.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "watch.png"); panel = injector.getInstance(TimeTrackingPanel.class); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java index e3ce75f631..8e8c8a3c92 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java @@ -71,14 +71,14 @@ public class ClockTabPanel extends TabContentPanel static { - BufferedImage deleteIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "delete_icon.png"); - BufferedImage lapIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "lap_icon.png"); - BufferedImage pauseIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "pause_icon.png"); - BufferedImage resetIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "reset_icon.png"); - BufferedImage startIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "start_icon.png"); - BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "add_icon.png"); - BufferedImage loopIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "loop_icon.png"); - BufferedImage loopSelectedIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "loop_selected_icon.png"); + BufferedImage deleteIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "delete_icon.png"); + BufferedImage lapIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "lap_icon.png"); + BufferedImage pauseIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "pause_icon.png"); + BufferedImage resetIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "reset_icon.png"); + BufferedImage startIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "start_icon.png"); + BufferedImage addIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "add_icon.png"); + BufferedImage loopIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "loop_icon.png"); + BufferedImage loopSelectedIcon = ImageUtil.loadImageResource(TimeTrackingPlugin.class, "loop_selected_icon.png"); DELETE_ICON = new ImageIcon(deleteIcon); DELETE_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(deleteIcon, -80)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java index 6e3c094ef0..2803c43936 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java @@ -54,7 +54,7 @@ class WorldTableHeader extends JPanel static { - final BufferedImage arrowDown = ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "arrow_down.png"); + final BufferedImage arrowDown = ImageUtil.loadImageResource(WorldHopperPlugin.class, "arrow_down.png"); final BufferedImage arrowUp = ImageUtil.rotateImage(arrowDown, Math.PI); final BufferedImage arrowUpFaded = ImageUtil.luminanceOffset(arrowUp, -80); ARROW_UP = new ImageIcon(arrowUpFaded); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java index eb39459f32..fc46f386da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java @@ -66,10 +66,10 @@ class WorldTableRow extends JPanel static { - FLAG_AUS = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_aus.png")); - FLAG_UK = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_uk.png")); - FLAG_US = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_us.png")); - FLAG_GER = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_ger.png")); + FLAG_AUS = new ImageIcon(ImageUtil.loadImageResource(WorldHopperPlugin.class, "flag_aus.png")); + FLAG_UK = new ImageIcon(ImageUtil.loadImageResource(WorldHopperPlugin.class, "flag_uk.png")); + FLAG_US = new ImageIcon(ImageUtil.loadImageResource(WorldHopperPlugin.class, "flag_us.png")); + FLAG_GER = new ImageIcon(ImageUtil.loadImageResource(WorldHopperPlugin.class, "flag_ger.png")); } private final JMenuItem favoriteMenuOption = new JMenuItem(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java index 11cdad457f..d09ced3ce9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java @@ -33,7 +33,7 @@ class RunecraftingAltarPoint extends WorldMapPoint RunecraftingAltarPoint(RunecraftingAltarLocation point) { super(point.getLocation(), WorldMapPlugin.BLANK_ICON); - setImage(ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, point.getIconPath())); + setImage(ImageUtil.loadImageResource(WorldMapPlugin.class, point.getIconPath())); setTooltip(point.getTooltip()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java index c8c2a778cb..a1171cfbc6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java @@ -34,6 +34,6 @@ class TeleportPoint extends WorldMapPoint { super(data.getLocation(), WorldMapPlugin.BLANK_ICON); setTooltip(data.getTooltip()); - setImage(ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, data.getIconPath())); + setImage(ImageUtil.loadImageResource(WorldMapPlugin.class, data.getIconPath())); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java index dc0d25a722..518edd0668 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java @@ -101,31 +101,31 @@ public class WorldMapPlugin extends Plugin BLANK_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); FAIRY_TRAVEL_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage fairyTravelIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "fairy_ring_travel.png"); + final BufferedImage fairyTravelIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "fairy_ring_travel.png"); FAIRY_TRAVEL_ICON.getGraphics().drawImage(fairyTravelIcon, 1, 1, null); NOPE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage nopeImage = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "nope_icon.png"); + final BufferedImage nopeImage = ImageUtil.loadImageResource(WorldMapPlugin.class, "nope_icon.png"); NOPE_ICON.getGraphics().drawImage(nopeImage, 1, 1, null); NOT_STARTED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage notStartedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_not_started_icon.png"); + final BufferedImage notStartedIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "quest_not_started_icon.png"); NOT_STARTED_ICON.getGraphics().drawImage(notStartedIcon, 4, 4, null); STARTED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage startedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_started_icon.png"); + final BufferedImage startedIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "quest_started_icon.png"); STARTED_ICON.getGraphics().drawImage(startedIcon, 4, 4, null); FINISHED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage finishedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_completed_icon.png"); + final BufferedImage finishedIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "quest_completed_icon.png"); FINISHED_ICON.getGraphics().drawImage(finishedIcon, 4, 4, null); MINING_SITE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage miningSiteIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "mining_site_icon.png"); + final BufferedImage miningSiteIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "mining_site_icon.png"); MINING_SITE_ICON.getGraphics().drawImage(miningSiteIcon, 1, 1, null); ROOFTOP_COURSE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); - final BufferedImage rooftopCourseIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "rooftop_course_icon.png"); + final BufferedImage rooftopCourseIcon = ImageUtil.loadImageResource(WorldMapPlugin.class, "rooftop_course_icon.png"); ROOFTOP_COURSE_ICON.getGraphics().drawImage(rooftopCourseIcon, 1, 1, null); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index 9ae532a8db..4fd1f02516 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -157,7 +157,7 @@ public class XpTrackerPlugin extends Plugin { xpPanel = new XpPanel(this, xpTrackerConfig, client, skillIconManager); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "/skill_icons/overall.png"); + final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "/skill_icons/overall.png"); navButton = NavigationButton.builder() .tooltip("XP Tracker") diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java index 8e19ddcf1a..f36892d127 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java @@ -108,7 +108,7 @@ public class ClientUI private static final String CONFIG_CLIENT_BOUNDS = "clientBounds"; private static final String CONFIG_CLIENT_MAXIMIZED = "clientMaximized"; private static final String CONFIG_CLIENT_SIDEBAR_CLOSED = "clientSidebarClosed"; - public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png"); + public static final BufferedImage ICON = ImageUtil.loadImageResource(ClientUI.class, "/runelite.png"); @Getter private TrayIcon trayIcon; @@ -474,7 +474,7 @@ public class ClientUI // Create hide sidebar button - sidebarOpenIcon = ImageUtil.getResourceStreamFromClass(ClientUI.class, withTitleBar ? "open.png" : "open_rs.png"); + sidebarOpenIcon = ImageUtil.loadImageResource(ClientUI.class, withTitleBar ? "open.png" : "open_rs.png"); sidebarClosedIcon = ImageUtil.flipImage(sidebarOpenIcon, true, false); sidebarNavigationButton = NavigationButton diff --git a/runelite-client/src/main/java/net/runelite/client/ui/FatalErrorDialog.java b/runelite-client/src/main/java/net/runelite/client/ui/FatalErrorDialog.java index dcf1b9fe48..23591f8dcf 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/FatalErrorDialog.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/FatalErrorDialog.java @@ -81,7 +81,7 @@ public class FatalErrorDialog extends JDialog try { - BufferedImage logo = ImageUtil.getResourceStreamFromClass(FatalErrorDialog.class, "runelite_transparent.png"); + BufferedImage logo = ImageUtil.loadImageResource(FatalErrorDialog.class, "runelite_transparent.png"); setIconImage(logo); JLabel runelite = new JLabel(); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java index 77cac7340b..8eca11dd17 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java @@ -68,7 +68,7 @@ public class SplashScreen extends JFrame implements ActionListener private SplashScreen() throws IOException { - BufferedImage logo = ImageUtil.getResourceStreamFromClass(SplashScreen.class, "runelite_transparent.png"); + BufferedImage logo = ImageUtil.loadImageResource(SplashScreen.class, "runelite_transparent.png"); setTitle("RuneLite Launcher"); 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 66e9930ab5..3efeabcfa4 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 @@ -331,16 +331,25 @@ public class ImageUtil return outlinedImage; } + /** + * @see #loadImageResource(Class, String) + */ + @Deprecated + public static BufferedImage getResourceStreamFromClass(Class c, String path) + { + return loadImageResource(c, path); + } + /** * Reads an image resource from a given path relative to a given class. * This method is primarily shorthand for the synchronization and error handling required for - * loading image resources from classes. + * loading image resources from the classpath. * - * @param c The class to be referenced for resource path. + * @param c The class to be referenced for the package path. * @param path The path, relative to the given class. * @return A {@link BufferedImage} of the loaded image resource from the given path. */ - public static BufferedImage getResourceStreamFromClass(final Class c, final String path) + public static BufferedImage loadImageResource(final Class c, final String path) { try { @@ -359,7 +368,7 @@ public class ImageUtil } else { - filePath = c.getPackage().getName().replace(".", "/") + "/" + path; + filePath = c.getPackage().getName().replace('.', '/') + "/" + path; } log.warn("Failed to load image from class: {}, path: {}", c.getName(), filePath); From 60e27e94d22c0b36e94cfb50aa4077d37fb924f0 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Wed, 30 Dec 2020 23:16:43 -0700 Subject: [PATCH 128/173] worldhopper: use ImageUtil for loading images --- .../client/plugins/worldhopper/WorldHopperPlugin.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java index 8f9b9060b5..b10e2a0667 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java @@ -40,7 +40,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import javax.imageio.ImageIO; import javax.inject.Inject; import javax.swing.SwingUtilities; import lombok.AccessLevel; @@ -83,6 +82,7 @@ import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.util.ExecutorServiceExceptionLogger; import net.runelite.client.util.HotkeyListener; +import net.runelite.client.util.ImageUtil; import net.runelite.client.util.Text; import net.runelite.client.util.WorldUtil; import net.runelite.http.api.worlds.World; @@ -190,12 +190,7 @@ public class WorldHopperPlugin extends Plugin panel = new WorldSwitcherPanel(this); - final BufferedImage icon; - synchronized (ImageIO.class) - { - icon = ImageIO.read(getClass().getResourceAsStream("icon.png")); - } - + BufferedImage icon = ImageUtil.loadImageResource(WorldHopperPlugin.class, "icon.png"); navButton = NavigationButton.builder() .tooltip("World Switcher") .icon(icon) From 476a6bb6d242723f651c0351b5cc62be5ab44588 Mon Sep 17 00:00:00 2001 From: Christian Gati Date: Wed, 30 Dec 2020 22:41:42 -0800 Subject: [PATCH 129/173] Add Green Tears of Guthix Timer (#12862) --- .../tearsofguthix/TearsOfGuthixOverlay.java | 18 ++++++++++++++++-- .../tearsofguthix/TearsOfGuthixPlugin.java | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) 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 ea0a3861dc..08a4168ecc 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 @@ -30,6 +30,7 @@ import java.awt.Graphics2D; import java.time.Duration; import java.time.Instant; import javax.inject.Inject; +import net.runelite.api.ObjectID; import net.runelite.api.Point; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; @@ -39,6 +40,7 @@ import net.runelite.client.ui.overlay.components.ProgressPieComponent; 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 TearsOfGuthixPlugin plugin; @@ -64,8 +66,20 @@ class TearsOfGuthixOverlay extends Overlay final ProgressPieComponent progressPie = new ProgressPieComponent(); progressPie.setDiameter(15); - progressPie.setFill(CYAN_ALPHA); - progressPie.setBorderColor(Color.CYAN); + + if (object.getId() == ObjectID.BLUE_TEARS || + object.getId() == ObjectID.BLUE_TEARS_6665) + { + progressPie.setFill(CYAN_ALPHA); + progressPie.setBorderColor(Color.CYAN); + } + else if (object.getId() == ObjectID.GREEN_TEARS || + object.getId() == ObjectID.GREEN_TEARS_6666) + { + progressPie.setFill(GREEN_ALPHA); + progressPie.setBorderColor(Color.GREEN); + } + progressPie.setPosition(position); final Duration duration = Duration.between(timer, Instant.now()); 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 d75eb0bb6a..d7b0217235 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 @@ -92,7 +92,9 @@ public class TearsOfGuthixPlugin extends Plugin DecorativeObject object = event.getDecorativeObject(); if (object.getId() == ObjectID.BLUE_TEARS || - object.getId() == ObjectID.BLUE_TEARS_6665) + object.getId() == ObjectID.BLUE_TEARS_6665 || + object.getId() == ObjectID.GREEN_TEARS || + object.getId() == ObjectID.GREEN_TEARS_6666) { if (client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION) { From ead554e23b8457fe78a9766f0d30720db3dcca42 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Fri, 20 Nov 2020 13:50:16 -0800 Subject: [PATCH 130/173] itemstats: Add Darkmeyer foods --- .../net/runelite/client/plugins/itemstats/ItemStatChanges.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java index 6391628e4d..a5dc493f5b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java @@ -60,7 +60,7 @@ public class ItemStatChanges add(food(3), SHRIMPS, COOKED_MEAT, COOKED_CHICKEN, ROE, CHOCOLATE_BAR); add(food(4), SARDINE, CAKE, _23_CAKE, SLICE_OF_CAKE, CHOCOLATEY_MILK, BAKED_POTATO, EDIBLE_SEAWEED, MOONLIGHT_MEAD); add(food(5), BREAD, HERRING, CHOCOLATE_CAKE, _23_CHOCOLATE_CAKE, CHOCOLATE_SLICE, COOKED_RABBIT, CHILLI_CON_CARNE, - FRIED_MUSHROOMS, FRIED_ONIONS, REDBERRY_PIE, HALF_A_REDBERRY_PIE, CAVIAR, PYSK_FISH_0); + FRIED_MUSHROOMS, FRIED_ONIONS, REDBERRY_PIE, HALF_A_REDBERRY_PIE, CAVIAR, PYSK_FISH_0, COOKED_MYSTERY_MEAT); add(food(6), CHOCICE, MACKEREL, MEAT_PIE, HALF_A_MEAT_PIE, GUANIC_BAT_0, ROAST_BIRD_MEAT, SQUARE_SANDWICH, ROLL, BAGUETTE, TRIANGLE_SANDWICH, GIANT_CARP); add(food(7), TROUT, COD, PLAIN_PIZZA, _12_PLAIN_PIZZA, APPLE_PIE, HALF_AN_APPLE_PIE, ROAST_RABBIT, @@ -111,6 +111,7 @@ public class ItemStatChanges add(combo(2, food(5), boost(STRENGTH, 4), heal(ATTACK, -3)), PREMADE_SGG, SHORT_GREEN_GUY); add(combo(2, food(5), boost(STRENGTH, 7), heal(ATTACK, -4)), PREMADE_DR_DRAGON, DRUNK_DRAGON); add(combo(2, food(5), boost(STRENGTH, 7), heal(ATTACK, -4)), PREMADE_CHOC_SDY, CHOC_SATURDAY); + add(combo(4, boost(ATTACK, 5), boost(STRENGTH, 5), heal(MAGIC, -5), heal(PRAYER, -5)), BLOOD_PINT); // Sq'irk Juice add(heal(RUN_ENERGY, 5), WINTER_SQIRKJUICE); From 870ad03d386601e0353bd1a3d06bab18fca01c75 Mon Sep 17 00:00:00 2001 From: CGOSURLDEV <74847565+CGOSURLDEV@users.noreply.github.com> Date: Thu, 31 Dec 2020 14:08:55 -0800 Subject: [PATCH 131/173] ge plugin: update config descriptions to be more descriptive --- .../plugins/grandexchange/GrandExchangeConfig.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java index 9cb66911af..c7db3ab0ab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java @@ -37,7 +37,7 @@ public interface GrandExchangeConfig extends Config position = 1, keyName = "quickLookup", name = "Hotkey lookup (Alt + Left click)", - description = "Configures whether to enable the hotkey lookup for ge searches" + description = "Configures whether to enable the hotkey lookup for GE searches" ) default boolean quickLookup() { @@ -59,7 +59,7 @@ public interface GrandExchangeConfig extends Config position = 3, keyName = "enableOsbPrices", name = "Enable OSB actively traded prices", - description = "Shows the OSBuddy actively traded price at the GE" + description = "Shows the OSBuddy actively traded price on the GE buy interface" ) default boolean enableOsbPrices() { @@ -92,8 +92,8 @@ public interface GrandExchangeConfig extends Config @ConfigItem( position = 6, keyName = "showTotal", - name = "Show grand exchange total", - description = "Show grand exchange total" + name = "Show GE total", + description = "Display the total value of all trades at the top of the GE interface" ) default boolean showTotal() { @@ -104,7 +104,7 @@ public interface GrandExchangeConfig extends Config position = 7, keyName = "showExact", name = "Show exact total value", - description = "Show exact total value" + description = "When enabled along with the ‘Show GE total’ option, the unabbreviated value will be displayed" ) default boolean showExact() { From fdd84f929de8199f50514f80d98f97dbbd6b20d6 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 31 Dec 2020 18:13:36 -0500 Subject: [PATCH 132/173] perspective: ignore invisible tris in clickbox calculation --- .../src/main/java/net/runelite/api/Perspective.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 87b7b287eb..eab5323d38 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -688,6 +688,7 @@ public class Perspective { int[] x2d = new int[m.getVerticesCount()]; int[] y2d = new int[m.getVerticesCount()]; + final int[] faceColors3 = m.getFaceColors3(); Perspective.modelToCanvas(client, m.getVerticesCount(), @@ -714,6 +715,11 @@ public class Perspective nextTri: for (int tri = 0; tri < m.getTrianglesCount(); tri++) { + if (faceColors3[tri] == -2) + { + continue; + } + int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE, From e60a1684172ccabce8bdf2bb54f05a0ad947d20d Mon Sep 17 00:00:00 2001 From: Minhs2 <32379779+Minhs2@users.noreply.github.com> Date: Fri, 1 Jan 2021 13:32:33 -0800 Subject: [PATCH 133/173] skill calc: add 4 dose potions Add 4 dose Extended Antifires and Anti-venoms to the herblore skill calculator. These potions are able and often are made using 4 doses at a time. Super Antifires and Anti-venom+'s can not be made using 3 doses at a time, so were fixed to display the right potion dose (4). The xp for these potions was already correct. --- .../skillcalculator/skill_herblore.json | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json index 650945b8d8..6e3c4c088b 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json @@ -360,6 +360,12 @@ "name": "Extended Antifire (3)", "xp": 82.5 }, + { + "level": 84, + "icon": 11951, + "name": "Extended Antifire (4)", + "xp": 110 + }, { "level": 86, "icon": 24635, @@ -378,6 +384,12 @@ "name": "Anti-venom(3)", "xp": 90 }, + { + "level": 87, + "icon": 12905, + "name": "Anti-venom(4)", + "xp": 120 + }, { "level": 90, "icon": 12695, @@ -386,14 +398,14 @@ }, { "level": 92, - "icon": 21981, - "name": "Super Antifire (3)", + "icon": 21978, + "name": "Super Antifire (4)", "xp": 130 }, { "level": 94, - "icon": 12915, - "name": "Anti-venom+(3)", + "icon": 12913, + "name": "Anti-venom+(4)", "xp": 125 }, { From 1dba59c89d5868b0c124e95af77cac391a3e3167 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Fri, 1 Jan 2021 19:54:56 -0500 Subject: [PATCH 134/173] timers: change Charge time to 7 minutes --- .../main/java/net/runelite/client/plugins/timers/GameTimer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java index a751b7f3f9..e4521feb9e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java @@ -60,7 +60,7 @@ enum GameTimer OVERLOAD_RAID(ItemID.OVERLOAD_4_20996, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES, true), PRAYER_ENHANCE(ItemID.PRAYER_ENHANCE_4, GameTimerImageType.ITEM, "Prayer enhance", 290, ChronoUnit.SECONDS, true), GOD_WARS_ALTAR(SpriteID.SKILL_PRAYER, GameTimerImageType.SPRITE, "God wars altar", 10, ChronoUnit.MINUTES), - CHARGE(SpriteID.SPELL_CHARGE, GameTimerImageType.SPRITE, "Charge", 6, ChronoUnit.MINUTES), + CHARGE(SpriteID.SPELL_CHARGE, GameTimerImageType.SPRITE, "Charge", 7, ChronoUnit.MINUTES), STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, GameTimerImageType.ITEM, "Staff of the Dead", 1, ChronoUnit.MINUTES), ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true), HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES), From 4ca8ef4d40b7c9a82567126148f3d23d2f48199d Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 2 Jan 2021 16:34:50 -0500 Subject: [PATCH 135/173] gpu: fix lighting textures The passed hsl for textured triangles is a 7-bit lightness, and should be directly multiplied into the texture color --- .../net/runelite/client/plugins/gpu/frag.glsl | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl index b89513a94e..df930d16be 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl @@ -43,26 +43,29 @@ out vec4 FragColor; #include colorblind.glsl void main() { - int hsl = int(fHsl); - vec3 rgb = hslToRgb(hsl) * smoothBanding + Color.rgb * (1.f - smoothBanding); - vec4 smoothColor = vec4(rgb, Color.a); + vec4 c; if (textureId > 0) { int textureIdx = textureId - 1; - vec2 uv = fUv; - vec2 animatedUv = uv + textureOffsets[textureIdx]; + vec2 animatedUv = fUv + textureOffsets[textureIdx]; vec4 textureColor = texture(textures, vec3(animatedUv, float(textureIdx))); vec4 textureColorBrightness = pow(textureColor, vec4(brightness, brightness, brightness, 1.0f)); - smoothColor = textureColorBrightness * smoothColor; + // textured triangles hsl is a 7 bit lightness 2-126 + float light = fHsl / 127.f; + c = textureColorBrightness * vec4(light, light, light, 1.f); + } else { + // pick interpolated hsl or rgb depending on smooth banding setting + vec3 rgb = hslToRgb(int(fHsl)) * smoothBanding + Color.rgb * (1.f - smoothBanding); + c = vec4(rgb, Color.a); } if (colorBlindMode > 0) { - smoothColor.rgb = colorblind(colorBlindMode, smoothColor.rgb); + c.rgb = colorblind(colorBlindMode, c.rgb); } - vec3 mixedColor = mix(smoothColor.rgb, fogColor.rgb, fogAmount); - FragColor = vec4(mixedColor, smoothColor.a); + vec3 mixedColor = mix(c.rgb, fogColor.rgb, fogAmount); + FragColor = vec4(mixedColor, c.a); } From 901f241333413e6ff713d35729d18b2575c7984d Mon Sep 17 00:00:00 2001 From: Matt Buell Date: Mon, 4 Jan 2021 21:47:39 -0500 Subject: [PATCH 136/173] clues: add fairy ring combination for Traiborn med clue step --- .../runelite/client/plugins/cluescrolls/clues/CipherClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java index ded2628348..a8aff43840 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java @@ -52,7 +52,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr new CipherClue("OVEXON", "Eluned", new WorldPoint(2289, 3144, 0), "Outside Lletya or in Prifddinas after Song of the Elves", "A question on elven crystal math. I have 5 and 3 crystals, large and small respectively. A large crystal is worth 10,000 coins and a small is worth but 1,000. How much are all my crystals worth?", "53,000"), new CipherClue("VTYR APCNTGLW", "King Percival", new WorldPoint(2634, 4682, 1), "Fisher Realm, first floor. Fairy ring BJR", "How many cannons are on this here castle?", "5"), new CipherClue("UZZU MUJHRKYYKJ", "Otto Godblessed", new WorldPoint(2501, 3487, 0), "Otto's Grotto", "How many pyre sites are found around this lake?", "3"), - new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower", "How many air runes would I need to cast 630 wind waves?", "3150"), + new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower. Fairy ring DIS", "How many air runes would I need to cast 630 wind waves?", "3150"), new CipherClue("HCKTA IQFHCVJGT", "Fairy Godfather", new WorldPoint(2446, 4428, 0), "Zanaris throne room", "There are 3 inputs and 4 letters on each ring How many total individual fairy ring codes are possible?", "64"), new CipherClue("ZSBKDO ZODO", "Pirate Pete", new WorldPoint(3680, 3537, 0), "Dock northeast of the Ectofunctus"), new CipherClue("GBJSZ RVFFO", "Fairy Queen", new WorldPoint(2347, 4435, 0), "Fairy Resistance Hideout"), From c5a52754e06abfc0f7dc35be0e86e3ec604d5040 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 5 Jan 2021 14:50:52 -0500 Subject: [PATCH 137/173] Fix Zalcano damage overlay to only show during Zalcano This varp is for the hp hud, and applies to more content than just Zalcano, so verify that the hp hud is for Zalcano --- runelite-api/src/main/java/net/runelite/api/VarPlayer.java | 6 ++---- .../net/runelite/client/plugins/zalcano/ZalcanoPlugin.java | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index d4653aeb9c..c11574e662 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -188,11 +188,9 @@ public enum VarPlayer MOUSE_BUTTONS(170), /** - * Zalcano's form - * -1 : Player is outside or Zalcano is dead i.e. there's no healthbar to show - * Anything else : The {@link NpcID} of the current form + * {@link NpcID} for the HP HUD */ - ZALCANO_FORM(1683); + HP_HUD_NPC_ID(1683); private final int id; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java index fdaa151b29..b529c54aef 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java @@ -265,6 +265,7 @@ public class ZalcanoPlugin extends Plugin private boolean isHealthbarActive() { - return client.getVar(VarPlayer.ZALCANO_FORM) != -1; + int npcId = client.getVar(VarPlayer.HP_HUD_NPC_ID); + return npcId == ZALCANO_WEAKENED || npcId == ZALCANO; } } From 9b70d64960e7ffd60d2efc8018ac69930fbd53e4 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Wed, 6 Jan 2021 12:18:00 +0000 Subject: [PATCH 138/173] Update Item IDs to 2021-01-06-rev193 --- .../main/java/net/runelite/api/ItemID.java | 68 +++++++++++++++---- .../java/net/runelite/api/NullItemID.java | 28 ++++++++ .../woodcutting/CrowdsourcingWoodcutting.java | 2 +- .../client/plugins/fishing/FishingPlugin.java | 2 +- .../client/plugins/mining/Pickaxe.java | 4 +- .../client/plugins/woodcutting/Axe.java | 4 +- 6 files changed, 89 insertions(+), 19 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 6301bf633d..66ef6c0323 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -624,7 +624,7 @@ public final class ItemID public static final int SILK = 950; public static final int SPADE = 952; public static final int ROPE = 954; - public static final int FLIER = 956; + public static final int FLYER = 956; public static final int GREY_WOLF_FUR = 958; public static final int PLANK = 960; public static final int CHRISTMAS_CRACKER = 962; @@ -5007,7 +5007,7 @@ public final class ItemID public static final int SARADOMIN_ICON = 8058; public static final int ZAMORAK_ICON = 8059; public static final int GUTHIX_ICON = 8060; - public static final int ICON_OF_BOB = 8061; + public static final int BOB_ICON = 8061; public static final int OAK_ALTAR = 8062; public static final int TEAK_ALTAR = 8063; public static final int CLOTHCOVERED_ALTAR = 8064; @@ -10753,7 +10753,7 @@ public final class ItemID public static final int CRYSTAL_SAPLING = 23659; public static final int CRYSTAL_ACORN = 23661; public static final int DRAGONSTONE_ARMOUR_SET = 23667; - public static final int FLIER_23670 = 23670; + public static final int FLYER_23670 = 23670; public static final int CRYSTAL_AXE = 23673; public static final int CRYSTAL_AXE_INACTIVE = 23675; public static final int DRAGON_PICKAXE_OR = 23677; @@ -11491,19 +11491,18 @@ public final class ItemID public static final int CABBAGE_24994 = 24994; public static final int CABBAGE_24996 = 24996; public static final int TRAILBLAZER_HOOD_T3 = 25001; - public static final int TRAILBLAZER_COAT_T3 = 25004; + public static final int TRAILBLAZER_TOP_T3 = 25004; public static final int TRAILBLAZER_TROUSERS_T3 = 25007; public static final int TRAILBLAZER_BOOTS_T3 = 25010; public static final int TRAILBLAZER_CANE = 25013; public static final int TRAILBLAZER_HOOD_T2 = 25016; - public static final int TRAILBLAZER_COAT_T2 = 25019; + public static final int TRAILBLAZER_TOP_T2 = 25019; public static final int TRAILBLAZER_TROUSERS_T2 = 25022; public static final int TRAILBLAZER_BOOTS_T2 = 25025; public static final int TRAILBLAZER_HOOD_T1 = 25028; - public static final int TRAILBLAZER_COAT_T1 = 25031; + public static final int TRAILBLAZER_TOP_T1 = 25031; public static final int TRAILBLAZER_TROUSERS_T1 = 25034; public static final int TRAILBLAZER_BOOTS_T1 = 25037; - public static final int TRAILBLAZER_TROPHY = 25040; public static final int TRAILBLAZER_DRAGON_TROPHY = 25042; public static final int TRAILBLAZER_RUNE_TROPHY = 25044; public static final int TRAILBLAZER_ADAMANT_TROPHY = 25046; @@ -11512,9 +11511,9 @@ public final class ItemID public static final int TRAILBLAZER_IRON_TROPHY = 25052; public static final int TRAILBLAZER_BRONZE_TROPHY = 25054; public static final int TRAILBLAZER_BANNER = 25056; - public static final int TRAILBLAZER_HARPOON = 25059; - public static final int TRAILBLAZER_PICKAXE = 25063; - public static final int TRAILBLAZER_AXE = 25066; + public static final int INFERNAL_HARPOON_OR = 25059; + public static final int INFERNAL_PICKAXE_OR = 25063; + public static final int INFERNAL_AXE_OR = 25066; public static final int GRACEFUL_HOOD_25069 = 25069; public static final int GRACEFUL_HOOD_25071 = 25071; public static final int GRACEFUL_CAPE_25072 = 25072; @@ -11536,9 +11535,9 @@ public final class ItemID public static final int CRYSTAL_OF_MEMORIES = 25104; public static final int EXTRADIMENSIONAL_BAG = 25106; public static final int EXTRADIMENSIONAL_BAG_25108 = 25108; - public static final int TRAILBLAZER_AXE_25110 = 25110; - public static final int TRAILBLAZER_PICKAXE_25112 = 25112; - public static final int TRAILBLAZER_HARPOON_25114 = 25114; + public static final int TRAILBLAZER_AXE = 25110; + public static final int TRAILBLAZER_PICKAXE = 25112; + public static final int TRAILBLAZER_HARPOON = 25114; public static final int LEAGUE_TOMATO = 25117; public static final int BEEKEEPERS_HAT = 25129; public static final int BEEKEEPERS_TOP = 25131; @@ -11656,5 +11655,48 @@ public final class ItemID public static final int GOBLIN_GIFTS = 25290; public static final int GIANT_BOULDER = 25314; public static final int GOBLIN_DECORATIONS = 25316; + public static final int GNOME_CHILD_ICON = 25319; + public static final int GNOME_CHILD = 25320; + public static final int GNOME_CHILD_25321 = 25321; + public static final int _20TH_ANNIVERSARY_HAT = 25322; + public static final int _20TH_ANNIVERSARY_TOP = 25324; + public static final int _20TH_ANNIVERSARY_BOTTOM = 25326; + public static final int _20TH_ANNIVERSARY_BOOTS = 25328; + public static final int _20TH_ANNIVERSARY_GLOVES = 25330; + public static final int _20TH_ANNIVERSARY_NECKLACE = 25332; + public static final int _20TH_ANNIVERSARY_CAPE = 25334; + public static final int GNOME_CHILD_MASK = 25336; + public static final int GNOME_CHILD_ICON_25338 = 25338; + public static final int ECTOPLASMATOR = 25340; + public static final int SPOILS_OF_WAR = 25342; + public static final int SOUL_CAPE = 25344; + public static final int SOUL_CAPE_25346 = 25346; + public static final int LIL_CREATOR = 25348; + public static final int LIL_DESTRUCTOR = 25350; + public static final int TROPHY_PEDESTAL = 25351; + public static final int ORNATE_TROPHY_PEDESTAL = 25352; + public static final int OAK_TROPHY_CASE = 25353; + public static final int MAHOGANY_TROPHY_CASE = 25354; + public static final int BANNER_STAND = 25355; + public static final int ORNATE_BANNER_STAND = 25356; + public static final int OAK_OUTFIT_STAND = 25357; + public static final int MAHOGANY_OUTFIT_STAND = 25358; + public static final int LEAGUE_STATUE = 25359; + public static final int ORNATE_LEAGUE_STATUE = 25360; + public static final int TRAILBLAZER_GLOBE_25361 = 25361; + public static final int RUG_25362 = 25362; + public static final int OPULENT_RUG_25363 = 25363; + public static final int TRAILBLAZER_RUG_25364 = 25364; + public static final int LEAGUE_ACCOMPLISHMENTS_SCROLL = 25365; + public static final int LEAGUE_HALL = 25366; + public static final int INFERNAL_HARPOON_UNCHARGED_25367 = 25367; + public static final int INFERNAL_PICKAXE_UNCHARGED_25369 = 25369; + public static final int INFERNAL_AXE_UNCHARGED_25371 = 25371; + public static final int DRAGON_HARPOON_OR = 25373; + public static final int DRAGON_PICKAXE_OR_25376 = 25376; + public static final int DRAGON_AXE_OR = 25378; + public static final int TRAILBLAZER_RELIC_HUNTER_T1_ARMOUR_SET = 25380; + public static final int TRAILBLAZER_RELIC_HUNTER_T2_ARMOUR_SET = 25383; + public static final int TRAILBLAZER_RELIC_HUNTER_T3_ARMOUR_SET = 25386; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index bccd666609..c6fa2aadf0 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -13326,6 +13326,7 @@ public final class NullItemID public static final int NULL_25036 = 25036; public static final int NULL_25038 = 25038; public static final int NULL_25039 = 25039; + public static final int NULL_25040 = 25040; public static final int NULL_25041 = 25041; public static final int NULL_25043 = 25043; public static final int NULL_25045 = 25045; @@ -13452,5 +13453,32 @@ public final class NullItemID public static final int NULL_25315 = 25315; public static final int NULL_25317 = 25317; public static final int NULL_25318 = 25318; + public static final int NULL_25323 = 25323; + public static final int NULL_25325 = 25325; + public static final int NULL_25327 = 25327; + public static final int NULL_25329 = 25329; + public static final int NULL_25331 = 25331; + public static final int NULL_25333 = 25333; + public static final int NULL_25335 = 25335; + public static final int NULL_25337 = 25337; + public static final int NULL_25339 = 25339; + public static final int NULL_25341 = 25341; + public static final int NULL_25343 = 25343; + public static final int NULL_25345 = 25345; + public static final int NULL_25347 = 25347; + public static final int NULL_25349 = 25349; + public static final int NULL_25368 = 25368; + public static final int NULL_25370 = 25370; + public static final int NULL_25372 = 25372; + public static final int NULL_25374 = 25374; + public static final int NULL_25375 = 25375; + public static final int NULL_25377 = 25377; + public static final int NULL_25379 = 25379; + public static final int NULL_25381 = 25381; + public static final int NULL_25382 = 25382; + public static final int NULL_25384 = 25384; + public static final int NULL_25385 = 25385; + public static final int NULL_25387 = 25387; + public static final int NULL_25388 = 25388; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/woodcutting/CrowdsourcingWoodcutting.java b/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/woodcutting/CrowdsourcingWoodcutting.java index c8499575cf..e61a017960 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/woodcutting/CrowdsourcingWoodcutting.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/crowdsourcing/woodcutting/CrowdsourcingWoodcutting.java @@ -88,7 +88,7 @@ public class CrowdsourcingWoodcutting put(AnimationID.WOODCUTTING_INFERNAL, ItemID.INFERNAL_AXE). put(AnimationID.WOODCUTTING_3A_AXE, ItemID._3RD_AGE_AXE). put(AnimationID.WOODCUTTING_CRYSTAL, ItemID.CRYSTAL_AXE). - put(AnimationID.WOODCUTTING_TRAILBLAZER, ItemID.TRAILBLAZER_AXE).build(); + put(AnimationID.WOODCUTTING_TRAILBLAZER, ItemID.INFERNAL_AXE_OR).build(); private static final Set SUCCESS_MESSAGES = new ImmutableSet.Builder(). add("You get some logs."). diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java index 65257adeb8..4715450f79 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java @@ -274,8 +274,8 @@ public class FishingPlugin extends Plugin case ItemID.KARAMBWAN_VESSEL_3159: case ItemID.CORMORANTS_GLOVE: case ItemID.CORMORANTS_GLOVE_22817: + case ItemID.INFERNAL_HARPOON_OR: case ItemID.TRAILBLAZER_HARPOON: - case ItemID.TRAILBLAZER_HARPOON_25114: case ItemID.CRYSTAL_HARPOON: case ItemID.CRYSTAL_HARPOON_23864: case ItemID.CRYSTAL_HARPOON_INACTIVE: diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Pickaxe.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Pickaxe.java index edfd2826ff..c0531ac091 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Pickaxe.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Pickaxe.java @@ -73,7 +73,7 @@ import static net.runelite.api.ItemID.MITHRIL_PICKAXE; import static net.runelite.api.ItemID.RUNE_PICKAXE; import static net.runelite.api.ItemID.STEEL_PICKAXE; import static net.runelite.api.ItemID._3RD_AGE_PICKAXE; -import static net.runelite.api.ItemID.TRAILBLAZER_PICKAXE; +import static net.runelite.api.ItemID.INFERNAL_PICKAXE_OR; import net.runelite.api.Player; @Getter @@ -93,7 +93,7 @@ enum Pickaxe INFERNAL(INFERNAL_PICKAXE, MINING_INFERNAL_PICKAXE, MINING_MOTHERLODE_INFERNAL), THIRDAGE(_3RD_AGE_PICKAXE, MINING_3A_PICKAXE, MINING_MOTHERLODE_3A), CRYSTAL(CRYSTAL_PICKAXE, MINING_CRYSTAL_PICKAXE, MINING_MOTHERLODE_CRYSTAL), - TRAILBLAZER(TRAILBLAZER_PICKAXE, MINING_TRAILBLAZER_PICKAXE, MINING_TRAILBLAZER_PICKAXE_2, + TRAILBLAZER(INFERNAL_PICKAXE_OR, MINING_TRAILBLAZER_PICKAXE, MINING_TRAILBLAZER_PICKAXE_2, MINING_TRAILBLAZER_PICKAXE_3, MINING_MOTHERLODE_TRAILBLAZER); private final int itemId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java index 306e9dd346..90797e265d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java @@ -52,7 +52,7 @@ import static net.runelite.api.ItemID.IRON_AXE; import static net.runelite.api.ItemID.MITHRIL_AXE; import static net.runelite.api.ItemID.RUNE_AXE; import static net.runelite.api.ItemID.STEEL_AXE; -import static net.runelite.api.ItemID.TRAILBLAZER_AXE; +import static net.runelite.api.ItemID.INFERNAL_AXE_OR; import static net.runelite.api.ItemID._3RD_AGE_AXE; import net.runelite.api.Player; @@ -72,7 +72,7 @@ enum Axe INFERNAL(WOODCUTTING_INFERNAL, INFERNAL_AXE), THIRDAGE(WOODCUTTING_3A_AXE, _3RD_AGE_AXE), CRYSTAL(WOODCUTTING_CRYSTAL, CRYSTAL_AXE), - TRAILBLAZER(WOODCUTTING_TRAILBLAZER, TRAILBLAZER_AXE); + TRAILBLAZER(WOODCUTTING_TRAILBLAZER, INFERNAL_AXE_OR); private final Integer animId; private final Integer itemId; From c1c2403b3dc5bd9ae4b4e63e40e5c5152c72ff5b Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Wed, 6 Jan 2021 12:18:00 +0000 Subject: [PATCH 139/173] Update Item variations to 2021-01-06-rev193 --- .../src/main/resources/item_variations.json | 68 ++++++++++++++----- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 80dd7dd319..62877d1869 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -1623,7 +1623,7 @@ 11046, 20587 ], - "flier": [ + "flyer": [ 956, 23670 ], @@ -4838,6 +4838,10 @@ 23595, 25264 ], + "dragon axe": [ + 6739, + 25378 + ], "darklight": [ 6746, 8281 @@ -5878,6 +5882,14 @@ 8315, 8508 ], + "rug": [ + 8317, + 25362 + ], + "opulent rug": [ + 8318, + 25363 + ], "wooden bookcase": [ 8319, 24902 @@ -7470,7 +7482,8 @@ "dragon pickaxe": [ 11920, 12797, - 23677 + 23677, + 25376 ], "malediction ward": [ 11924, @@ -7936,11 +7949,15 @@ ], "infernal axe": [ 13241, - 13242 + 13242, + 25066, + 25371 ], "infernal pickaxe": [ 13243, - 13244 + 13244, + 25063, + 25369 ], "abyssal dagger": [ 13265, @@ -8530,9 +8547,15 @@ 21009, 21206 ], + "dragon harpoon": [ + 21028, + 25373 + ], "infernal harpoon": [ 21031, - 21033 + 21033, + 25059, + 25367 ], "medium storage unit": [ 21038, @@ -9510,7 +9533,7 @@ 25016, 25028 ], - "trailblazer coat": [ + "trailblazer top": [ 25004, 25019, 25031 @@ -9525,17 +9548,13 @@ 25025, 25037 ], - "trailblazer harpoon": [ - 25059, - 25114 + "trailblazer globe": [ + 25093, + 25361 ], - "trailblazer pickaxe": [ - 25063, - 25112 - ], - "trailblazer axe": [ - 25066, - 25110 + "trailblazer rug": [ + 25096, + 25364 ], "extradimensional bag": [ 25106, @@ -9599,5 +9618,22 @@ 25241, 25242, 25243 + ], + "gnome child icon": [ + 25319, + 25338 + ], + "gnome child": [ + 25320, + 25321 + ], + "soul cape": [ + 25344, + 25346 + ], + "trailblazer relic hunter armour set": [ + 25380, + 25383, + 25386 ] } \ No newline at end of file From b584d710c8c1b8bc7899f9cccf9155a63e1238d2 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Wed, 6 Jan 2021 12:18:00 +0000 Subject: [PATCH 140/173] Update Object IDs to 2021-01-06-rev193 --- .../java/net/runelite/api/NullObjectID.java | 105 ++++++-- .../main/java/net/runelite/api/ObjectID.java | 253 +++++++++++++++--- 2 files changed, 301 insertions(+), 57 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index c17eb35c8e..1df3543f9f 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -890,6 +890,7 @@ public final class NullObjectID public static final int NULL_1807 = 1807; public static final int NULL_1808 = 1808; public static final int NULL_1809 = 1809; + public static final int NULL_1812 = 1812; public static final int NULL_1815 = 1815; public static final int NULL_1818 = 1818; public static final int NULL_1819 = 1819; @@ -5407,16 +5408,8 @@ public final class NullObjectID public static final int NULL_12383 = 12383; public static final int NULL_12384 = 12384; public static final int NULL_12385 = 12385; - public static final int NULL_12392 = 12392; - public static final int NULL_12393 = 12393; - public static final int NULL_12394 = 12394; - public static final int NULL_12395 = 12395; public static final int NULL_12397 = 12397; public static final int NULL_12398 = 12398; - public static final int NULL_12403 = 12403; - public static final int NULL_12404 = 12404; - public static final int NULL_12405 = 12405; - public static final int NULL_12406 = 12406; public static final int NULL_12416 = 12416; public static final int NULL_12417 = 12417; public static final int NULL_12418 = 12418; @@ -20009,31 +20002,93 @@ public final class NullObjectID public static final int NULL_40890 = 40890; public static final int NULL_40895 = 40895; public static final int NULL_40898 = 40898; - public static final int NULL_40900 = 40900; public static final int NULL_40907 = 40907; public static final int NULL_40908 = 40908; - public static final int NULL_40912 = 40912; - public static final int NULL_40913 = 40913; - public static final int NULL_40914 = 40914; - public static final int NULL_40915 = 40915; - public static final int NULL_40916 = 40916; - public static final int NULL_40917 = 40917; - public static final int NULL_40918 = 40918; - public static final int NULL_40919 = 40919; - public static final int NULL_40920 = 40920; - public static final int NULL_40921 = 40921; - public static final int NULL_40922 = 40922; - public static final int NULL_40923 = 40923; - public static final int NULL_40924 = 40924; public static final int NULL_40925 = 40925; public static final int NULL_40926 = 40926; public static final int NULL_40927 = 40927; public static final int NULL_40928 = 40928; - public static final int NULL_40929 = 40929; - public static final int NULL_40930 = 40930; - public static final int NULL_40931 = 40931; public static final int NULL_40934 = 40934; public static final int NULL_40935 = 40935; public static final int NULL_40936 = 40936; + public static final int NULL_40942 = 40942; + public static final int NULL_40943 = 40943; + public static final int NULL_40944 = 40944; + public static final int NULL_40945 = 40945; + public static final int NULL_40946 = 40946; + public static final int NULL_40947 = 40947; + public static final int NULL_40948 = 40948; + public static final int NULL_40949 = 40949; + public static final int NULL_40950 = 40950; + public static final int NULL_40951 = 40951; + public static final int NULL_40952 = 40952; + public static final int NULL_40953 = 40953; + public static final int NULL_40954 = 40954; + public static final int NULL_40955 = 40955; + public static final int NULL_40956 = 40956; + public static final int NULL_40957 = 40957; + public static final int NULL_40958 = 40958; + public static final int NULL_40959 = 40959; + public static final int NULL_40960 = 40960; + public static final int NULL_40961 = 40961; + public static final int NULL_40962 = 40962; + public static final int NULL_40963 = 40963; + public static final int NULL_40964 = 40964; + public static final int NULL_40965 = 40965; + public static final int NULL_40966 = 40966; + public static final int NULL_40967 = 40967; + public static final int NULL_40968 = 40968; + public static final int NULL_40969 = 40969; + public static final int NULL_40970 = 40970; + public static final int NULL_40971 = 40971; + public static final int NULL_40972 = 40972; + public static final int NULL_40973 = 40973; + public static final int NULL_40974 = 40974; + public static final int NULL_40975 = 40975; + public static final int NULL_40976 = 40976; + public static final int NULL_40977 = 40977; + public static final int NULL_40978 = 40978; + public static final int NULL_40979 = 40979; + public static final int NULL_40980 = 40980; + public static final int NULL_40981 = 40981; + public static final int NULL_40982 = 40982; + public static final int NULL_40983 = 40983; + public static final int NULL_40984 = 40984; + public static final int NULL_40985 = 40985; + public static final int NULL_40987 = 40987; + public static final int NULL_40988 = 40988; + public static final int NULL_40989 = 40989; + public static final int NULL_40990 = 40990; + public static final int NULL_40991 = 40991; + public static final int NULL_40992 = 40992; + public static final int NULL_40993 = 40993; + public static final int NULL_40994 = 40994; + public static final int NULL_40995 = 40995; + public static final int NULL_40996 = 40996; + public static final int NULL_40997 = 40997; + public static final int NULL_40998 = 40998; + public static final int NULL_40999 = 40999; + public static final int NULL_41000 = 41000; + public static final int NULL_41001 = 41001; + public static final int NULL_41002 = 41002; + public static final int NULL_41003 = 41003; + public static final int NULL_41004 = 41004; + public static final int NULL_41005 = 41005; + public static final int NULL_41006 = 41006; + public static final int NULL_41007 = 41007; + public static final int NULL_41008 = 41008; + public static final int NULL_41009 = 41009; + public static final int NULL_41010 = 41010; + public static final int NULL_41011 = 41011; + public static final int NULL_41012 = 41012; + public static final int NULL_41013 = 41013; + public static final int NULL_41014 = 41014; + public static final int NULL_41015 = 41015; + public static final int NULL_41016 = 41016; + public static final int NULL_41018 = 41018; + public static final int NULL_41019 = 41019; + public static final int NULL_41020 = 41020; + public static final int NULL_41021 = 41021; + public static final int NULL_41022 = 41022; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 63f154fe47..076045bc19 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -928,8 +928,7 @@ public final class ObjectID public static final int DOOR_1805 = 1805; public static final int WEB_1810 = 1810; public static final int SLICED_WEB = 1811; - public static final int PORTAL = 1812; - public static final int STONE_STAND = 1813; + public static final int BANDAGE_TABLE = 1813; public static final int LEVER_1814 = 1814; public static final int LEVER_1816 = 1816; public static final int LEVER_1817 = 1817; @@ -2233,7 +2232,7 @@ public final class ObjectID public static final int SHELF_4062 = 4062; public static final int SINK_4063 = 4063; public static final int SMASHED_TABLE_4064 = 4064; - public static final int STONE_STAND_4065 = 4065; + public static final int STONE_STAND = 4065; public static final int SIGNPOST_4066 = 4066; public static final int WARNING_SIGN = 4067; public static final int BROKEN_WALL = 4068; @@ -2312,7 +2311,7 @@ public final class ObjectID public static final int CAVE_ENTRANCE_4147 = 4147; public static final int DOOR_4148 = 4148; public static final int LALLIS_STEW = 4149; - public static final int PORTAL_4150 = 4150; + public static final int PORTAL = 4150; public static final int PORTAL_4151 = 4151; public static final int PORTAL_4152 = 4152; public static final int PORTAL_4153 = 4153; @@ -6988,11 +6987,19 @@ public final class ObjectID public static final int LADDER_12389 = 12389; public static final int LADDER_12390 = 12390; public static final int LADDER_12391 = 12391; + public static final int SACKS_12392 = 12392; + public static final int SACKS_12393 = 12393; + public static final int SACK_PILE = 12394; + public static final int SACK_PILE_12395 = 12395; public static final int SACK_12396 = 12396; public static final int SACK_12399 = 12399; public static final int CAULDRON_12400 = 12400; public static final int CAULDRON_12401 = 12401; public static final int EXPLOSION = 12402; + public static final int SHELVES_12403 = 12403; + public static final int SHELVES_12404 = 12404; + public static final int CUPBOARD_12405 = 12405; + public static final int CUPBOARD_12406 = 12406; public static final int STOOL_12407 = 12407; public static final int STOOL_12408 = 12408; public static final int STOOL_12409 = 12409; @@ -9024,7 +9031,7 @@ public final class ObjectID public static final int LARGE_DOOR_15758 = 15758; public static final int DOOR_15759 = 15759; public static final int SACK_15760 = 15760; - public static final int SACK_PILE = 15761; + public static final int SACK_PILE_15761 = 15761; public static final int SACKS_15762 = 15762; public static final int BED_15767 = 15767; public static final int CRATE_15768 = 15768; @@ -20674,7 +20681,7 @@ public final class ObjectID public static final int NEUTRAL_BARRIER = 40439; public static final int PORTAL_40440 = 40440; public static final int PORTAL_40441 = 40441; - public static final int BANDAGE_TABLE = 40442; + public static final int BANDAGE_TABLE_40442 = 40442; public static final int BARRICADE_TABLE = 40443; public static final int BARRICADE_TABLE_40444 = 40444; public static final int EXPLOSIVE_POTION_TABLE = 40445; @@ -20851,22 +20858,22 @@ public final class ObjectID public static final int DOOR_40859 = 40859; public static final int DOOR_40860 = 40860; public static final int DOOR_40861 = 40861; - public static final int SACKS_40871 = 40871; - public static final int SACKS_40872 = 40872; - public static final int SACKS_40873 = 40873; - public static final int SACKS_40874 = 40874; - public static final int SACK_PILE_40875 = 40875; - public static final int SACK_PILE_40876 = 40876; - public static final int SACK_PILE_40877 = 40877; - public static final int SACK_PILE_40878 = 40878; - public static final int SHELVES_40879 = 40879; - public static final int SHELVES_40880 = 40880; - public static final int SHELVES_40881 = 40881; - public static final int SHELVES_40882 = 40882; - public static final int CUPBOARD_40883 = 40883; - public static final int CUPBOARD_40884 = 40884; - public static final int CUPBOARD_40885 = 40885; - public static final int CUPBOARD_40886 = 40886; + public static final int ICON_OF_GNOME_CHILD = 40871; + public static final int ALTAR_40872 = 40872; + public static final int ALTAR_40873 = 40873; + public static final int ALTAR_40874 = 40874; + public static final int ALTAR_40875 = 40875; + public static final int ALTAR_40876 = 40876; + public static final int ALTAR_40877 = 40877; + public static final int ALTAR_40878 = 40878; + public static final int DECORATIVE_WINDOW_40879 = 40879; + public static final int STAINEDGLASS_WINDOW_40880 = 40880; + public static final int DECORATIVE_WINDOW_40881 = 40881; + public static final int STAINEDGLASS_WINDOW_40882 = 40882; + public static final int DECORATIVE_WINDOW_40883 = 40883; + public static final int STAINEDGLASS_WINDOW_40884 = 40884; + public static final int DECORATIVE_WINDOW_40885 = 40885; + public static final int STAINEDGLASS_WINDOW_40886 = 40886; public static final int CAVE_ENTRANCE_40887 = 40887; public static final int CAVE_EXIT_40888 = 40888; public static final int CREVICE_40889 = 40889; @@ -20876,19 +20883,201 @@ public final class ObjectID public static final int SLOPE_END = 40894; public static final int PEBBLES = 40896; public static final int BOULDER_40897 = 40897; - public static final int BOULDER_40899 = 40899; - public static final int STICK_40901 = 40901; - public static final int STICK_40902 = 40902; - public static final int CAULDRON_40903 = 40903; - public static final int TREASURE_CHEST_40904 = 40904; + public static final int DECORATIVE_WINDOW_40899 = 40899; + public static final int STAINEDGLASS_WINDOW_40900 = 40900; + public static final int DECORATIVE_WINDOW_40901 = 40901; + public static final int STAINEDGLASS_WINDOW_40902 = 40902; + public static final int DECORATIVE_WINDOW_40903 = 40903; + public static final int STAINEDGLASS_WINDOW_40904 = 40904; public static final int ROCKS_40905 = 40905; public static final int ROCKS_40906 = 40906; - public static final int SOCKING = 40909; - public static final int SOCKING_40910 = 40910; - public static final int SOCKING_40911 = 40911; + public static final int DECORATIVE_WINDOW_40909 = 40909; + public static final int STAINEDGLASS_WINDOW_40910 = 40910; + public static final int DECORATIVE_WINDOW_40911 = 40911; + public static final int STAINEDGLASS_WINDOW_40912 = 40912; + public static final int DECORATIVE_WINDOW_40913 = 40913; + public static final int STAINEDGLASS_WINDOW_40914 = 40914; + public static final int STATUE_40915 = 40915; + public static final int STATUE_40916 = 40916; + public static final int STATUE_40917 = 40917; + public static final int INERT_PORTAL = 40918; + public static final int PORTAL_40919 = 40919; + public static final int ODD_FEATHERS = 40920; + public static final int PORTAL_40921 = 40921; + public static final int BARRIER_40922 = 40922; + public static final int SLEEPING_BAG_40923 = 40923; + public static final int STATUE_40924 = 40924; + public static final int ARCHWAY_40929 = 40929; + public static final int LIGHT_40930 = 40930; + public static final int LIGHT_40931 = 40931; public static final int EVERGREEN_40932 = 40932; public static final int EVERGREEN_40933 = 40933; - public static final int TREE_40937 = 40937; - public static final int TREE_40938 = 40938; + public static final int LIGHT_40937 = 40937; + public static final int LIGHT_40938 = 40938; + public static final int LIGHT_40939 = 40939; + public static final int LIGHT_40940 = 40940; + public static final int FIREWORKS = 40941; + public static final int POST_40986 = 40986; + public static final int PARTY_TABLE = 41017; + public static final int POTION_OF_POWER_TABLE_41023 = 41023; + public static final int PEDESTAL_SPACE = 41024; + public static final int PEDESTAL_SPACE_41025 = 41025; + public static final int PEDESTAL_SPACE_41026 = 41026; + public static final int TROPHY_CASE_SPACE = 41027; + public static final int BANNER_STAND_SPACE = 41028; + public static final int OUTFIT_STAND_SPACE = 41029; + public static final int STATUE_SPACE_41030 = 41030; + public static final int RUG_SPACE_41031 = 41031; + public static final int RUG_SPACE_41032 = 41032; + public static final int RUG_SPACE_41033 = 41033; + public static final int ACCOMPLISHMENT_SCROLL_SPACE = 41034; + public static final int TROPHY_PEDESTAL = 41035; + public static final int TROPHY_PEDESTAL_41036 = 41036; + public static final int TROPHY_PEDESTAL_41037 = 41037; + public static final int TROPHY_PEDESTAL_41038 = 41038; + public static final int TROPHY_PEDESTAL_41039 = 41039; + public static final int TROPHY_PEDESTAL_41040 = 41040; + public static final int TROPHY_PEDESTAL_41041 = 41041; + public static final int TROPHY_PEDESTAL_41042 = 41042; + public static final int TROPHY_PEDESTAL_41043 = 41043; + public static final int TROPHY_PEDESTAL_41044 = 41044; + public static final int TROPHY_PEDESTAL_41045 = 41045; + public static final int TROPHY_PEDESTAL_41046 = 41046; + public static final int TROPHY_PEDESTAL_41047 = 41047; + public static final int TROPHY_PEDESTAL_41048 = 41048; + public static final int TROPHY_PEDESTAL_41049 = 41049; + public static final int ORNATE_TROPHY_PEDESTAL = 41050; + public static final int ORNATE_TROPHY_PEDESTAL_41051 = 41051; + public static final int ORNATE_TROPHY_PEDESTAL_41052 = 41052; + public static final int ORNATE_TROPHY_PEDESTAL_41053 = 41053; + public static final int ORNATE_TROPHY_PEDESTAL_41054 = 41054; + public static final int ORNATE_TROPHY_PEDESTAL_41055 = 41055; + public static final int ORNATE_TROPHY_PEDESTAL_41056 = 41056; + public static final int ORNATE_TROPHY_PEDESTAL_41057 = 41057; + public static final int ORNATE_TROPHY_PEDESTAL_41058 = 41058; + public static final int ORNATE_TROPHY_PEDESTAL_41059 = 41059; + public static final int ORNATE_TROPHY_PEDESTAL_41060 = 41060; + public static final int ORNATE_TROPHY_PEDESTAL_41061 = 41061; + public static final int ORNATE_TROPHY_PEDESTAL_41062 = 41062; + public static final int ORNATE_TROPHY_PEDESTAL_41063 = 41063; + public static final int ORNATE_TROPHY_PEDESTAL_41064 = 41064; + public static final int TROPHY_PEDESTAL_41065 = 41065; + public static final int TROPHY_PEDESTAL_41066 = 41066; + public static final int TROPHY_PEDESTAL_41067 = 41067; + public static final int TROPHY_PEDESTAL_41068 = 41068; + public static final int TROPHY_PEDESTAL_41069 = 41069; + public static final int TROPHY_PEDESTAL_41070 = 41070; + public static final int TROPHY_PEDESTAL_41071 = 41071; + public static final int TROPHY_PEDESTAL_41072 = 41072; + public static final int TROPHY_PEDESTAL_41073 = 41073; + public static final int TROPHY_PEDESTAL_41074 = 41074; + public static final int TROPHY_PEDESTAL_41075 = 41075; + public static final int TROPHY_PEDESTAL_41076 = 41076; + public static final int TROPHY_PEDESTAL_41077 = 41077; + public static final int TROPHY_PEDESTAL_41078 = 41078; + public static final int TROPHY_PEDESTAL_41079 = 41079; + public static final int ORNATE_TROPHY_PEDESTAL_41080 = 41080; + public static final int ORNATE_TROPHY_PEDESTAL_41081 = 41081; + public static final int ORNATE_TROPHY_PEDESTAL_41082 = 41082; + public static final int ORNATE_TROPHY_PEDESTAL_41083 = 41083; + public static final int ORNATE_TROPHY_PEDESTAL_41084 = 41084; + public static final int ORNATE_TROPHY_PEDESTAL_41085 = 41085; + public static final int ORNATE_TROPHY_PEDESTAL_41086 = 41086; + public static final int ORNATE_TROPHY_PEDESTAL_41087 = 41087; + public static final int ORNATE_TROPHY_PEDESTAL_41088 = 41088; + public static final int ORNATE_TROPHY_PEDESTAL_41089 = 41089; + public static final int ORNATE_TROPHY_PEDESTAL_41090 = 41090; + public static final int ORNATE_TROPHY_PEDESTAL_41091 = 41091; + public static final int ORNATE_TROPHY_PEDESTAL_41092 = 41092; + public static final int ORNATE_TROPHY_PEDESTAL_41093 = 41093; + public static final int ORNATE_TROPHY_PEDESTAL_41094 = 41094; + public static final int TROPHY_PEDESTAL_41095 = 41095; + public static final int TROPHY_PEDESTAL_41096 = 41096; + public static final int TROPHY_PEDESTAL_41097 = 41097; + public static final int TROPHY_PEDESTAL_41098 = 41098; + public static final int TROPHY_PEDESTAL_41099 = 41099; + public static final int TROPHY_PEDESTAL_41100 = 41100; + public static final int TROPHY_PEDESTAL_41101 = 41101; + public static final int TROPHY_PEDESTAL_41102 = 41102; + public static final int TROPHY_PEDESTAL_41103 = 41103; + public static final int TROPHY_PEDESTAL_41104 = 41104; + public static final int TROPHY_PEDESTAL_41105 = 41105; + public static final int TROPHY_PEDESTAL_41106 = 41106; + public static final int TROPHY_PEDESTAL_41107 = 41107; + public static final int TROPHY_PEDESTAL_41108 = 41108; + public static final int TROPHY_PEDESTAL_41109 = 41109; + public static final int ORNATE_TROPHY_PEDESTAL_41110 = 41110; + public static final int ORNATE_TROPHY_PEDESTAL_41111 = 41111; + public static final int ORNATE_TROPHY_PEDESTAL_41112 = 41112; + public static final int ORNATE_TROPHY_PEDESTAL_41113 = 41113; + public static final int ORNATE_TROPHY_PEDESTAL_41114 = 41114; + public static final int ORNATE_TROPHY_PEDESTAL_41115 = 41115; + public static final int ORNATE_TROPHY_PEDESTAL_41116 = 41116; + public static final int ORNATE_TROPHY_PEDESTAL_41117 = 41117; + public static final int ORNATE_TROPHY_PEDESTAL_41118 = 41118; + public static final int ORNATE_TROPHY_PEDESTAL_41119 = 41119; + public static final int ORNATE_TROPHY_PEDESTAL_41120 = 41120; + public static final int ORNATE_TROPHY_PEDESTAL_41121 = 41121; + public static final int ORNATE_TROPHY_PEDESTAL_41122 = 41122; + public static final int ORNATE_TROPHY_PEDESTAL_41123 = 41123; + public static final int ORNATE_TROPHY_PEDESTAL_41124 = 41124; + public static final int RUG_41125 = 41125; + public static final int OPULENT_RUG = 41126; + public static final int RUG_41127 = 41127; + public static final int OPULENT_RUG_41128 = 41128; + public static final int RUG_41129 = 41129; + public static final int OPULENT_RUG_41130 = 41130; + public static final int TRAILBLAZER_RUG = 41131; + public static final int TRAILBLAZER_RUG_41132 = 41132; + public static final int TRAILBLAZER_RUG_41133 = 41133; + public static final int TRAILBLAZER_RUG_41134 = 41134; + public static final int TRAILBLAZER_RUG_41135 = 41135; + public static final int TRAILBLAZER_RUG_41136 = 41136; + public static final int TRAILBLAZER_RUG_41137 = 41137; + public static final int TRAILBLAZER_RUG_41138 = 41138; + public static final int TRAILBLAZER_RUG_41139 = 41139; + public static final int TRAILBLAZER_RUG_41140 = 41140; + public static final int TRAILBLAZER_RUG_41141 = 41141; + public static final int TRAILBLAZER_RUG_41142 = 41142; + public static final int TRAILBLAZER_RUG_41143 = 41143; + public static final int TRAILBLAZER_RUG_41144 = 41144; + public static final int TRAILBLAZER_RUG_41145 = 41145; + public static final int TRAILBLAZER_RUG_41146 = 41146; + public static final int TRAILBLAZER_RUG_41147 = 41147; + public static final int TRAILBLAZER_RUG_41148 = 41148; + public static final int TRAILBLAZER_RUG_41149 = 41149; + public static final int TRAILBLAZER_RUG_41150 = 41150; + public static final int TRAILBLAZER_RUG_41151 = 41151; + public static final int TRAILBLAZER_RUG_41152 = 41152; + public static final int TRAILBLAZER_RUG_41153 = 41153; + public static final int TRAILBLAZER_RUG_41154 = 41154; + public static final int OAK_TROPHY_CASE = 41155; + public static final int OAK_TROPHY_CASE_41156 = 41156; + public static final int MAHOGANY_TROPHY_CASE = 41157; + public static final int MAHOGANY_TROPHY_CASE_41158 = 41158; + public static final int BANNER_STAND = 41159; + public static final int BANNER_STAND_41160 = 41160; + public static final int BANNER_STAND_41161 = 41161; + public static final int ORNATE_BANNER_STAND = 41162; + public static final int ORNATE_BANNER_STAND_41163 = 41163; + public static final int ORNATE_BANNER_STAND_41164 = 41164; + public static final int OAK_OUTFIT_STAND = 41165; + public static final int OAK_OUTFIT_STAND_41166 = 41166; + public static final int OAK_OUTFIT_STAND_41167 = 41167; + public static final int OAK_OUTFIT_STAND_41168 = 41168; + public static final int OAK_OUTFIT_STAND_41169 = 41169; + public static final int OAK_OUTFIT_STAND_41170 = 41170; + public static final int OAK_OUTFIT_STAND_41171 = 41171; + public static final int MAHOGANY_OUTFIT_STAND = 41172; + public static final int MAHOGANY_OUTFIT_STAND_41173 = 41173; + public static final int MAHOGANY_OUTFIT_STAND_41174 = 41174; + public static final int MAHOGANY_OUTFIT_STAND_41175 = 41175; + public static final int MAHOGANY_OUTFIT_STAND_41176 = 41176; + public static final int MAHOGANY_OUTFIT_STAND_41177 = 41177; + public static final int MAHOGANY_OUTFIT_STAND_41178 = 41178; + public static final int LEAGUE_STATUE = 41179; + public static final int ORNATE_LEAGUE_STATUE = 41180; + public static final int TRAILBLAZER_GLOBE = 41181; + public static final int LEAGUE_ACCOMPLISHMENT_SCROLL = 41182; /* This file is automatically generated. Do not edit. */ } From ff8c1e4c7fc74c636eb73f1f4d38bbb40b8feaca Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Wed, 6 Jan 2021 12:18:01 +0000 Subject: [PATCH 141/173] Update NPC IDs to 2021-01-06-rev193 --- .../src/main/java/net/runelite/api/NpcID.java | 43 ++++++++++++++----- .../main/java/net/runelite/api/NullNpcID.java | 7 +-- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index cb028faaad..15460768d9 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -2657,9 +2657,7 @@ public final class NpcID public static final int DRYAD = 2828; public static final int FAIRY_2829 = 2829; public static final int MYSTERIOUS_OLD_MAN = 2830; - public static final int LIZARD_MAN = 2831; - public static final int ORC = 2832; - public static final int TROLL_2833 = 2833; + public static final int LIL_CREATOR = 2833; public static final int GIANT_BAT = 2834; public static final int CAMEL = 2835; public static final int GOLEM = 2836; @@ -3340,9 +3338,9 @@ public final class NpcID public static final int VERONICA = 3561; public static final int PROFESSOR_ODDENSTEIN = 3562; public static final int ERNEST = 3563; - public static final int CHICKEN_3564 = 3564; + public static final int LIL_DESTRUCTOR = 3564; public static final int SKELETON_3565 = 3565; - public static final int WITCH_3566 = 3566; + public static final int LIL_CREATOR_3566 = 3566; public static final int PENTYN = 3568; public static final int ARISTARCHUS = 3569; public static final int BONEGUARD = 3570; @@ -4683,7 +4681,7 @@ public final class NpcID public static final int ELEMENTAL_BALANCE_5004 = 5004; public static final int WIZARD_GRAYZAG = 5006; public static final int IMP_5007 = 5007; - public static final int IMP_5008 = 5008; + public static final int LIL_DESTRUCTOR_5008 = 5008; public static final int ELEMENTAL_BALANCE_5009 = 5009; public static final int ELEMENTAL_BALANCE_5010 = 5010; public static final int ELEMENTAL_BALANCE_5011 = 5011; @@ -8921,13 +8919,38 @@ public final class NpcID public static final int FORGOTTEN_SOUL_10545 = 10545; public static final int DUCK_10546 = 10546; public static final int DUCK_10547 = 10547; - public static final int SCRUBFOOT = 10558; - public static final int SCRUBFOOT_10559 = 10559; + public static final int CHICKEN_10556 = 10556; + public static final int GNOME_CHILD_10557 = 10557; + public static final int GNOME_CHILD_10558 = 10558; + public static final int SCRUBFOOT = 10559; + public static final int GNOME_CHILD_10560 = 10560; public static final int RED_FIREFLIES = 10561; - public static final int RED_FIREFLIES_10562 = 10562; + public static final int GNOME_CHILD_10562 = 10562; + public static final int THRANDER = 10563; public static final int GREEN_FIREFLIES = 10564; - public static final int GREEN_FIREFLIES_10565 = 10565; + public static final int CHUCK_10565 = 10565; public static final int GOBLIN_10566 = 10566; public static final int GOBLIN_10567 = 10567; + public static final int PIOUS_PETE = 10568; + public static final int MYSTERIOUS_WATCHER = 10569; + public static final int MYSTERIOUS_WATCHER_10570 = 10570; + public static final int MYSTERIOUS_WATCHER_10571 = 10571; + public static final int BIG_MO = 10572; + public static final int CHEERLEADER_10573 = 10573; + public static final int CHEERLEADER_10574 = 10574; + public static final int CHEERLEADER_10575 = 10575; + public static final int BLACK_DRAGON_10576 = 10576; + public static final int RED_DRAGON_10577 = 10577; + public static final int BLUE_DRAGON_10578 = 10578; + public static final int KING_BLACK_DRAGON_10579 = 10579; + public static final int BABY_BLUE_DRAGON_10580 = 10580; + public static final int LESSER_DEMON_10581 = 10581; + public static final int GREATER_DEMON_10582 = 10582; + public static final int BLACK_DEMON_10583 = 10583; + public static final int SCORPION_10584 = 10584; + public static final int KING_SCORPION_10585 = 10585; + public static final int ORC = 10586; + public static final int LIZARD_MAN = 10587; + public static final int TROLL_10588 = 10588; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java index ebc7194221..622f0fc904 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullNpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullNpcID.java @@ -173,6 +173,8 @@ public final class NullNpcID public static final int NULL_2779 = 2779; public static final int NULL_2780 = 2780; public static final int NULL_2781 = 2781; + public static final int NULL_2831 = 2831; + public static final int NULL_2832 = 2832; public static final int NULL_2934 = 2934; public static final int NULL_2935 = 2935; public static final int NULL_2936 = 2936; @@ -421,7 +423,6 @@ public final class NullNpcID public static final int NULL_6140 = 6140; public static final int NULL_6141 = 6141; public static final int NULL_6142 = 6142; - public static final int NULL_6143 = 6143; public static final int NULL_6144 = 6144; public static final int NULL_6145 = 6145; public static final int NULL_6146 = 6146; @@ -1618,9 +1619,5 @@ public final class NullNpcID public static final int NULL_10553 = 10553; public static final int NULL_10554 = 10554; public static final int NULL_10555 = 10555; - public static final int NULL_10556 = 10556; - public static final int NULL_10557 = 10557; - public static final int NULL_10560 = 10560; - public static final int NULL_10563 = 10563; /* This file is automatically generated. Do not edit. */ } From 4b4eb6f3a0a836b98306f014a5f61df5534665cb Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 6 Jan 2021 14:58:41 +0000 Subject: [PATCH 142/173] Release 1.6.36 --- 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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 7237ada310..8aba23fb8d 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 3ff21397e4..1e79860742 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index a1504d9cf6..ac2664bce0 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index d26c2d8144..6fa2bd38a5 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 4ff5310d69..ac0c34bcbb 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 Web Service diff --git a/pom.xml b/pom.xml index 58d4067acf..a2a63d510b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.6.36 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index c7f83d7b0a..8c0067cd4c 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index afb140a94a..cd186f9e15 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index b8e3ef2786..885d7a070a 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36-SNAPSHOT + 1.6.36 script-assembler-plugin From f9aa8d7eee969bd066ae14dc47b8f1b0ed8ffb9c Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 6 Jan 2021 14:58:50 +0000 Subject: [PATCH 143/173] Bump for 1.6.37-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 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 8aba23fb8d..69f343d321 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 1e79860742..810ceddb04 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index ac2664bce0..48c5d61313 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 6fa2bd38a5..859446c8a6 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index ac0c34bcbb..2d5940328a 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index a2a63d510b..11465f772f 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.6.36 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 8c0067cd4c..c2ea427d12 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index cd186f9e15..eca6efed54 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 885d7a070a..0195a635c4 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.36 + 1.6.37-SNAPSHOT script-assembler-plugin From b27bb9fab372bcfebf523f40be9c9d40d847abc4 Mon Sep 17 00:00:00 2001 From: "Chad J. Lewis" <31491443+cjlewis11@users.noreply.github.com> Date: Wed, 6 Jan 2021 11:34:16 -0700 Subject: [PATCH 144/173] WidgetInfo: Remove unused SHOP_ITEMS_CONTAINER definition (#13011) --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 1 - .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 1 - .../java/net/runelite/client/plugins/examine/ExaminePlugin.java | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index cf5597004c..9440c5d979 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -303,7 +303,6 @@ public class WidgetID static class Shop { - static final int ITEMS_CONTAINER = 2; static final int INVENTORY_ITEM_CONTAINER = 0; } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 486bd504e1..37da0f0fc9 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -161,7 +161,6 @@ public enum WidgetInfo DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER(WidgetID.DEPOSIT_BOX_GROUP_ID, WidgetID.DepositBox.INVENTORY_ITEM_CONTAINER), - SHOP_ITEMS_CONTAINER(WidgetID.SHOP_GROUP_ID, WidgetID.Shop.ITEMS_CONTAINER), SHOP_INVENTORY_ITEMS_CONTAINER(WidgetID.SHOP_INVENTORY_GROUP_ID, WidgetID.Shop.INVENTORY_ITEM_CONTAINER), SMITHING_INVENTORY_ITEMS_CONTAINER(WidgetID.SMITHING_GROUP_ID, WidgetID.Smithing.INVENTORY_ITEM_CONTAINER), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java index 976082dcd7..72e7f4a085 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java @@ -314,7 +314,7 @@ public class ExaminePlugin extends Plugin return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; } } - else if (WidgetInfo.SHOP_ITEMS_CONTAINER.getGroupId() == widgetGroup) + else if (WidgetID.SHOP_GROUP_ID == widgetGroup) { Widget widgetItem = widget.getChild(actionParam); if (widgetItem != null) From 9777f0227d61505a687880aeea11511c84fc4847 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Mon, 28 Dec 2020 16:22:34 +0000 Subject: [PATCH 145/173] barrows: fix reward potential formatting showing too many 0s --- .../client/plugins/barrows/BarrowsBrotherSlainOverlay.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java index 22103f5e79..c7cdef0058 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.barrows; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; +import java.text.DecimalFormat; import javax.inject.Inject; import net.runelite.api.Client; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; @@ -42,6 +43,8 @@ import net.runelite.client.ui.overlay.components.LineComponent; public class BarrowsBrotherSlainOverlay extends OverlayPanel { + private static final DecimalFormat REWARD_POTENTIAL_FORMATTER = new DecimalFormat("##0.00%"); + private final Client client; @Inject @@ -84,10 +87,9 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel } final int rewardPotential = rewardPotential(); - float rewardPercent = rewardPotential / 10.12f; panelComponent.getChildren().add(LineComponent.builder() .left("Potential") - .right(rewardPercent != 0 ? rewardPercent + "%" : "0%") + .right(REWARD_POTENTIAL_FORMATTER.format(rewardPotential / 1012f)) .rightColor(rewardPotential >= 756 && rewardPotential < 881 ? Color.GREEN : rewardPotential < 631 ? Color.WHITE : Color.YELLOW) .build()); From 0f17ecdaeadacc93cb4a16e6903b6208251ac852 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Jan 2021 14:27:01 -0500 Subject: [PATCH 146/173] http-api: add soul wars hiscores --- .../main/java/net/runelite/http/api/hiscore/HiscoreResult.java | 3 +++ .../net/runelite/http/api/hiscore/HiscoreResultBuilder.java | 1 + .../main/java/net/runelite/http/api/hiscore/HiscoreSkill.java | 1 + .../net/runelite/http/service/hiscore/HiscoreServiceTest.java | 2 ++ 4 files changed, 7 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java index aae95b9b83..949a022254 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java @@ -65,6 +65,7 @@ public class HiscoreResult private Skill clueScrollElite; private Skill clueScrollMaster; private Skill lastManStanding; + private Skill soulWarsZeal; private Skill abyssalSire; private Skill alchemicalHydra; private Skill barrowsChests; @@ -184,6 +185,8 @@ public class HiscoreResult return getClueScrollMaster(); case LAST_MAN_STANDING: return getLastManStanding(); + case SOUL_WARS_ZEAL: + return getSoulWarsZeal(); case ABYSSAL_SIRE: return abyssalSire; case ALCHEMICAL_HYDRA: diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java index 430755e7dd..5631a5b713 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java @@ -87,6 +87,7 @@ class HiscoreResultBuilder hiscoreResult.setClueScrollElite(skills.get(index++)); hiscoreResult.setClueScrollMaster(skills.get(index++)); hiscoreResult.setLastManStanding(skills.get(index++)); + hiscoreResult.setSoulWarsZeal(skills.get(index++)); // seasonal doesn't have boss hiscores if (index < skills.size()) { diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java index e20fafac0f..caebed437d 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java @@ -69,6 +69,7 @@ public enum HiscoreSkill CLUE_SCROLL_ELITE("Clue Scrolls (elite)", ACTIVITY), CLUE_SCROLL_MASTER("Clue Scrolls (master)", ACTIVITY), LAST_MAN_STANDING("Last Man Standing", ACTIVITY), + SOUL_WARS_ZEAL("Soul Wars Zeal", ACTIVITY), ABYSSAL_SIRE("Abyssal Sire", BOSS), ALCHEMICAL_HYDRA("Alchemical Hydra", BOSS), BARROWS_CHESTS("Barrows Chests", BOSS), diff --git a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java index d825d3047b..1a9e79a7f4 100644 --- a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java +++ b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java @@ -71,6 +71,7 @@ public class HiscoreServiceTest + "1,777\n" + "254,92\n" + "-1,-1\n" // lms + + "1,241\n" // soul wars + "24870,37\n" + "15020,388\n" + "50463,147\n" @@ -150,6 +151,7 @@ public class HiscoreServiceTest Assert.assertEquals(777, result.getClueScrollElite().getLevel()); Assert.assertEquals(254, result.getClueScrollMaster().getRank()); Assert.assertEquals(-1, result.getLastManStanding().getLevel()); + Assert.assertEquals(241, result.getSoulWarsZeal().getLevel()); Assert.assertEquals(2460, result.getLeaguePoints().getLevel()); Assert.assertEquals(37, result.getAbyssalSire().getLevel()); Assert.assertEquals(92357, result.getCallisto().getRank()); From 86940e139b3848bef0fb80c7fbde4eb7824b7be9 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Jan 2021 14:27:09 -0500 Subject: [PATCH 147/173] hiscore panel: add soul wars zeal --- .../client/plugins/hiscore/HiscorePanel.java | 13 +++++++++++++ .../skill_icons_small/soul_wars_zeal.png | Bin 0 -> 430 bytes 2 files changed, 13 insertions(+) create mode 100644 runelite-client/src/main/resources/skill_icons_small/soul_wars_zeal.png diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index 3da379b2f7..25191a428f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -282,6 +282,7 @@ public class HiscorePanel extends PluginPanel minigamePanel.add(makeHiscorePanel(CLUE_SCROLL_ALL)); minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS)); minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING)); + minigamePanel.add(makeHiscorePanel(SOUL_WARS_ZEAL)); minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE)); minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER)); @@ -595,6 +596,18 @@ public class HiscorePanel extends PluginPanel } break; } + case SOUL_WARS_ZEAL: + { + Skill soulWarsZeal = result.getSoulWarsZeal(); + String rank = (soulWarsZeal.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(soulWarsZeal.getRank()); + content += "

    Soul Wars Zeal

    "; + content += "

    Rank: " + rank + "

    "; + if (soulWarsZeal.getLevel() > -1) + { + content += "

    Score: " + QuantityFormatter.formatNumber(soulWarsZeal.getLevel()) + "

    "; + } + break; + } case LEAGUE_POINTS: { Skill leaguePoints = result.getLeaguePoints(); diff --git a/runelite-client/src/main/resources/skill_icons_small/soul_wars_zeal.png b/runelite-client/src/main/resources/skill_icons_small/soul_wars_zeal.png new file mode 100644 index 0000000000000000000000000000000000000000..2201b0a6f418facc1f6775685741499044095fc9 GIT binary patch literal 430 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMfmH?j+*Z=?j1DQ=l-nt=&59{h4 z*3;Dv-lrYBf4{c&el2bFpdA{4J2ZlJ?9kBIsiC0~uu;W-<3<$~1-}&vek&DxSDNUn z08Ln_ps+$gLB@N5wD$rTp9RuB3l_*oFOZgAAS1ItT1MP+y13W$>EhzkCB%h2`h?v3 zggpBCgoXQsg!_es`-Ft}-CFtF+W1}D_*~oC`1#uS`P=w_h>zQ)p4+9ao|~(Vo4byS zo5QKHf`h%1gMFLQgC9UgGnNGT1v5B2yO9RutnhSk43W4Tdj6$YlY$6K0^4aFV`Jvq z;<{VUik;nb@Bdz=laue(*Rby}Zdt+Tk;@R!HQ({Fipi|_#&z3OBytyvl=y7cKKLqf zn#hf^_&Kc>eaZ~X&Uy58-J+&bx?959f{q=TwSQOWO@1{l W?&F)iwv+?i%;4$j=d#Wzp$Py~R+|q1 literal 0 HcmV?d00001 From ae18d2a865240103a0a58b564f32e6de6f20499e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 6 Jan 2021 17:39:14 -0500 Subject: [PATCH 148/173] overlay: fix layouted overlays not respecting parent bounds This clamps layouted overlays to their parent's bounds, and also adjusts the snap corner for the shifted position that is a result of the clamp, so that the following overlays correctly get layouted. --- .../client/ui/overlay/OverlayRenderer.java | 48 +++++++++++-------- .../client/ui/overlay/OverlayUtil.java | 10 ++-- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index e1666d8b14..5c01f578c8 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -266,29 +266,35 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener else { final Rectangle bounds = overlay.getBounds(); - final Point location = bounds.getLocation(); final Dimension dimension = bounds.getSize(); - final Point preferredLocation = overlay.getPreferredLocation(); + Point location; // If the final position is not modified, layout it if (overlayPosition != OverlayPosition.DETACHED && (preferredLocation == null || overlay.getPreferredPosition() != null)) { final Rectangle snapCorner = snapCorners.forPosition(overlayPosition); - final Point translation = OverlayUtil.transformPosition(overlayPosition, dimension); - location.setLocation(snapCorner.getX() + translation.x, snapCorner.getY() + translation.y); - final Point padding = OverlayUtil.padPosition(overlayPosition, dimension, PADDING); - snapCorner.translate(padding.x, padding.y); + final Point translation = OverlayUtil.transformPosition(overlayPosition, dimension); // offset from corner + // Target x/y to draw the overlay + int destX = (int) snapCorner.getX() + translation.x; + int destY = (int) snapCorner.getY() + translation.y; + // Clamp the target position to ensure it is on screen or within parent bounds + location = clampOverlayLocation(destX, destY, dimension.width, dimension.height, overlay); + // Diff final position to target position in order to add it to the snap corner padding. The + // overlay effectively takes up the difference of (clamped location - target location) in + // addition to its normal dimensions. + int dX = location.x - destX; + int dY = location.y - destY; + final Point padding = OverlayUtil.padPosition(overlayPosition, dimension, PADDING); // overlay size + fixed padding + // translate corner for padding and any difference due to the position clamping + snapCorner.translate(padding.x + dX, padding.y + dY); } else { - if (preferredLocation != null) - { - location.setLocation(preferredLocation); - } + location = preferredLocation != null ? preferredLocation : bounds.getLocation(); // Clamp the overlay position to ensure it is on screen or within parent bounds - clampOverlayLocation(location, dimension.width, dimension.height, overlay); + location = clampOverlayLocation(location.x, location.y, dimension.width, dimension.height, overlay); } if (overlay.getPreferredSize() != null) @@ -605,7 +611,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener // Clamp drag to parent component final Rectangle overlayBounds = currentManagedOverlay.getBounds(); - clampOverlayLocation(overlayPosition, overlayBounds.width, overlayBounds.height, currentManagedOverlay); + overlayPosition = clampOverlayLocation(overlayPosition.x, overlayPosition.y, overlayBounds.width, overlayBounds.height, currentManagedOverlay); currentManagedOverlay.setPreferredPosition(null); currentManagedOverlay.setPreferredLocation(overlayPosition); } @@ -920,12 +926,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener /** * Adjust the given overlay position to be within its parent's bounds. * - * @param overlayPosition the overlay position, which is modified in place + * @param overlayX + * @param overlayY * @param overlayWidth * @param overlayHeight - * @param overlay the overlay + * @param overlay the overlay + * @return the clamped position */ - private void clampOverlayLocation(Point overlayPosition, int overlayWidth, int overlayHeight, Overlay overlay) + private Point clampOverlayLocation(int overlayX, int overlayY, int overlayWidth, int overlayHeight, Overlay overlay) { Rectangle parentBounds = overlay.getParentBounds(); if (parentBounds == null || parentBounds.isEmpty()) @@ -936,9 +944,11 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } // Constrain overlay position to be within the parent bounds - overlayPosition.x = Ints.constrainToRange(overlayPosition.x, parentBounds.x, - Math.max(parentBounds.x, parentBounds.width - overlayWidth)); - overlayPosition.y = Ints.constrainToRange(overlayPosition.y, parentBounds.y, - Math.max(parentBounds.y, parentBounds.height - overlayHeight)); + return new Point( + Ints.constrainToRange(overlayX, parentBounds.x, + Math.max(parentBounds.x, parentBounds.width - overlayWidth)), + Ints.constrainToRange(overlayY, parentBounds.y, + Math.max(parentBounds.y, parentBounds.height - overlayHeight)) + ); } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java index e5fc071ae3..7a59965f68 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java @@ -217,8 +217,6 @@ public class OverlayUtil break; case TOP_LEFT: case TOP_CENTER: - result.y += dimension.height + (dimension.height == 0 ? 0 : padding); - break; case CANVAS_TOP_RIGHT: case TOP_RIGHT: result.y += dimension.height + (dimension.height == 0 ? 0 : padding); @@ -242,18 +240,18 @@ public class OverlayUtil case TOP_LEFT: break; case TOP_CENTER: - result.x = result.x - dimension.width / 2; + result.x = -dimension.width / 2; break; case BOTTOM_LEFT: - result.y = result.y - dimension.height; + result.y = -dimension.height; break; case BOTTOM_RIGHT: case ABOVE_CHATBOX_RIGHT: - result.y = result.y - dimension.height; + result.y = -dimension.height; // FALLTHROUGH case CANVAS_TOP_RIGHT: case TOP_RIGHT: - result.x = result.x - dimension.width; + result.x = -dimension.width; break; } From 85a282b8afb2c876d86a5a5a077ae33fa134f605 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Wed, 6 Jan 2021 15:06:37 -0500 Subject: [PATCH 149/173] discord: add Soul Wars regions --- .../runelite/client/plugins/discord/DiscordGameEventType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java index f14b259277..17b72b5d6e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java @@ -297,6 +297,7 @@ enum DiscordGameEventType MG_PYRAMID_PLUNDER("Pyramid Plunder", DiscordAreaType.MINIGAMES, 7749), MG_ROGUES_DEN("Rogues' Den", DiscordAreaType.MINIGAMES, 11855, 11854, 12111, 12110), MG_SORCERESS_GARDEN("Sorceress's Garden", DiscordAreaType.MINIGAMES, 11605), + MG_SOUL_WARS("Soul Wars", DiscordAreaType.MINIGAMES, 8493, 8748, 8749, 9005), MG_TEMPLE_TREKKING("Temple Trekking", DiscordAreaType.MINIGAMES, 8014, 8270, 8256, 8782, 9038, 9294, 9550, 9806), MG_TITHE_FARM("Tithe Farm", DiscordAreaType.MINIGAMES, 7222), MG_TROUBLE_BREWING("Trouble Brewing", DiscordAreaType.MINIGAMES, 15150), From ed1d47f28325bf5c99dc2bf4376ec5ab60113b3a Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 7 Jan 2021 14:13:51 -0800 Subject: [PATCH 150/173] ChatboxTextInput: Select full message on ctrl+a --- .../net/runelite/client/game/chatbox/ChatboxTextInput.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index a11aad1e1c..0369dc6d69 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -689,6 +689,11 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse log.warn("Unable to get clipboard", ex); } return; + case KeyEvent.VK_A: + selectionStart = 0; + selectionEnd = value.length(); + cursorAt(0, selectionEnd); + return; } return; } From 3fa6371e7fcfa8a8fd3ff8db7b0fddd16c32a05f Mon Sep 17 00:00:00 2001 From: Mrnice98 <49848962+Mrnice98@users.noreply.github.com> Date: Thu, 7 Jan 2021 17:48:05 -0500 Subject: [PATCH 151/173] world map: add mining rock info for Ancient Cavern --- .../runelite/client/plugins/worldmap/MiningSiteLocation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java index 21358d1e0f..b01f709250 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java @@ -40,6 +40,9 @@ enum MiningSiteLocation new Rock(3, Ore.COPPER), new Rock(1, Ore.TIN), new Rock(7, Ore.IRON), new Rock(5, Ore.SILVER), new Rock(3, Ore.COAL), new Rock(3, Ore.MITHRIL), new Rock(2, Ore.ADAMANTITE)), AL_KHARID_MINE_SOUTH(new WorldPoint(3298, 3282, 0), new Rock(2, Ore.IRON), new Rock(2, Ore.GOLD)), + ANCIENT_CAVERN_NORTH(new WorldPoint(1847, 5414, 0), new Rock(4, Ore.MITHRIL)), + ANCIENT_CAVERN_SOUTH(new WorldPoint(1826, 5392, 0), new Rock(2, Ore.MITHRIL)), + ANCIENT_CAVERN_MIDDLE(new WorldPoint(1840, 5397, 0), new Rock(8, Ore.MITHRIL)), ARANDAR(new WorldPoint(2322, 3269, 0), new Rock(8, Ore.LIMESTONE)), ARANDAR_PRIFDDINAS_MAP(new WorldPoint(3346, 6021, 0), new Rock(8, Ore.LIMESTONE)), ARCEUUS_NORTH(new WorldPoint(1763, 3860, 0), new Rock(1, Ore.DENSE_ESSENCE)), From 1f95987d1acf5f9b5e7c5cb94ff4ad179967d4d8 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Thu, 7 Jan 2021 15:06:53 -0800 Subject: [PATCH 152/173] ChatboxTextInput: Improve open selection left/right handling Previously, when pressing left or right without Shift pressed, the cursor would end up one character left or right of the start of the selection, which is not expected behavior compared to how most programs handle this case. This commit changes this behavior to place the cursor at the start or end of the selection when pressing left or right, respectively, when a selection is active. --- .../client/game/chatbox/ChatboxTextInput.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index a11aad1e1c..89cc771cc4 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -753,11 +753,25 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse return; case KeyEvent.VK_LEFT: ev.consume(); - newPos--; + if (cursorStart != cursorEnd) + { + newPos = cursorStart; + } + else + { + newPos--; + } break; case KeyEvent.VK_RIGHT: ev.consume(); - newPos++; + if (cursorStart != cursorEnd) + { + newPos = cursorEnd; + } + else + { + newPos++; + } break; case KeyEvent.VK_UP: ev.consume(); From aa1cd2c7ff79e368db6769d1c09f6b8a11c917d9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 7 Jan 2021 16:45:10 -0500 Subject: [PATCH 153/173] spec counter: prevent dark core, zombified spawn, and combat dummies from reseting counter These are commonly attacked during boss fights or whilst speccing down bosses and shouldn't reset the counter Co-authored-by: vitorebom --- .../plugins/specialcounter/SpecialCounterPlugin.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 dbe313272c..5ca87940ff 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 @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.specialcounter; +import com.google.common.collect.ImmutableSet; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -38,6 +39,7 @@ import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; import net.runelite.api.NPC; +import net.runelite.api.NpcID; import net.runelite.api.VarPlayer; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.HitsplatApplied; @@ -62,6 +64,11 @@ import net.runelite.client.ws.WSClient; @Slf4j public class SpecialCounterPlugin extends Plugin { + private static final Set IGNORED_NPCS = ImmutableSet.of( + NpcID.DARK_ENERGY_CORE, NpcID.ZOMBIFIED_SPAWN, NpcID.ZOMBIFIED_SPAWN_8063, + NpcID.COMBAT_DUMMY, NpcID.UNDEAD_COMBAT_DUMMY + ); + private int currentWorld; private int specialPercentage; private Actor lastSpecTarget; @@ -191,6 +198,11 @@ public class SpecialCounterPlugin extends Plugin NPC npc = (NPC) target; int interactingId = npc.getId(); + if (IGNORED_NPCS.contains(interactingId)) + { + return; + } + // If this is a new NPC reset the counters if (!interactedNpcIds.contains(interactingId)) { From ecb7b46117a5559e20972de2ca318894bd023747 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Fri, 8 Jan 2021 12:32:18 -0500 Subject: [PATCH 154/173] loot tracker: Add Spoils of war (Soul Wars) Ignore player loot while in Soul Wars regions --- .../plugins/loottracker/LootTrackerPlugin.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 6f8c1d966d..b622aaaa41 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 @@ -227,6 +227,10 @@ public class LootTrackerPlugin extends Plugin private static final String CASKET_EVENT = "Casket"; + // Soul Wars + private static final String SPOILS_OF_WAR_EVENT = "Spoils of war"; + private static final Set SOUL_WARS_REGIONS = ImmutableSet.of(8493, 8749, 9005); + private static final Set VOWELS = ImmutableSet.of('a', 'e', 'i', 'o', 'u'); @Inject @@ -487,8 +491,8 @@ public class LootTrackerPlugin extends Plugin @Subscribe public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) { - // Ignore Last Man Standing player loots - if (isPlayerWithinMapRegion(LAST_MAN_STANDING_REGIONS)) + // Ignore Last Man Standing and Soul Wars player loots + if (isPlayerWithinMapRegion(LAST_MAN_STANDING_REGIONS) || isPlayerWithinMapRegion(SOUL_WARS_REGIONS)) { return; } @@ -763,6 +767,7 @@ public class LootTrackerPlugin extends Plugin || SEEDPACK_EVENT.equals(eventType) || CASKET_EVENT.equals(eventType) || BIRDNEST_EVENT.equals(eventType) + || SPOILS_OF_WAR_EVENT.equals(eventType) || eventType.endsWith("Bird House") || eventType.startsWith("H.A.M. chest") || lootRecordType == LootRecordType.PICKPOCKET) @@ -808,6 +813,12 @@ public class LootTrackerPlugin extends Plugin setEvent(LootRecordType.EVENT, CASKET_EVENT); takeInventorySnapshot(); } + + if (event.getMenuOption().equals("Open") && event.getId() == ItemID.SPOILS_OF_WAR) + { + setEvent(LootRecordType.EVENT, SPOILS_OF_WAR_EVENT); + takeInventorySnapshot(); + } } @Schedule( From cb22bdd0268027b1c7dca0ce9ce33a01afb70e52 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 7 Jan 2021 10:43:37 -0500 Subject: [PATCH 155/173] gpu: add option to use old texture brightness code --- .../net/runelite/client/plugins/gpu/GpuPlugin.java | 3 +++ .../client/plugins/gpu/GpuPluginConfig.java | 13 ++++++++++++- .../net/runelite/client/plugins/gpu/frag.glsl | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 7cbe5f31b0..826f95fd47 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -269,6 +269,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks private int uniBlockLarge; private int uniBlockMain; private int uniSmoothBanding; + private int uniTextureLightMode; @Override protected void startUp() @@ -538,6 +539,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks uniFogDepth = gl.glGetUniformLocation(glProgram, "fogDepth"); uniDrawDistance = gl.glGetUniformLocation(glProgram, "drawDistance"); uniColorBlindMode = gl.glGetUniformLocation(glProgram, "colorBlindMode"); + uniTextureLightMode = gl.glGetUniformLocation(glProgram, "textureLightMode"); uniTex = gl.glGetUniformLocation(glUiProgram, "tex"); uniTexSamplingMode = gl.glGetUniformLocation(glUiProgram, "samplingMode"); @@ -1151,6 +1153,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks gl.glUniform1f(uniBrightness, (float) textureProvider.getBrightness()); gl.glUniform1f(uniSmoothBanding, config.smoothBanding() ? 0f : 1f); gl.glUniform1i(uniColorBlindMode, config.colorBlindMode().ordinal()); + gl.glUniform1f(uniTextureLightMode, config.brightTextures() ? 1f : 0f); // Calculate projection matrix Matrix4 projectionMatrix = new Matrix4(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java index bef0ce2921..9f276fa8e1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java @@ -28,9 +28,9 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; import net.runelite.client.config.Range; +import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_DISTANCE; import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_FOG_DEPTH; import net.runelite.client.plugins.gpu.config.AntiAliasingMode; -import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_DISTANCE; import net.runelite.client.plugins.gpu.config.ColorBlindMode; import net.runelite.client.plugins.gpu.config.UIScalingMode; @@ -135,4 +135,15 @@ public interface GpuPluginConfig extends Config { return ColorBlindMode.NONE; } + + @ConfigItem( + keyName = "brightTextures", + name = "Bright Textures", + description = "Use old texture lighting method which results in brighter game textures", + position = 9 + ) + default boolean brightTextures() + { + return false; + } } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl index df930d16be..9b6ae61db8 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl @@ -30,6 +30,7 @@ uniform float brightness; uniform float smoothBanding; uniform vec4 fogColor; uniform int colorBlindMode; +uniform float textureLightMode; in vec4 Color; noperspective centroid in float fHsl; @@ -55,7 +56,8 @@ void main() { // textured triangles hsl is a 7 bit lightness 2-126 float light = fHsl / 127.f; - c = textureColorBrightness * vec4(light, light, light, 1.f); + vec3 mul = (1.f - textureLightMode) * vec3(light) + textureLightMode * Color.rgb; + c = textureColorBrightness * vec4(mul, 1.f); } else { // pick interpolated hsl or rgb depending on smooth banding setting vec3 rgb = hslToRgb(int(fHsl)) * smoothBanding + Color.rgb * (1.f - smoothBanding); From 4a214f9807e13b4ee2abf1d5ad9410bc587b1a0d Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 8 Jan 2021 14:24:37 -0500 Subject: [PATCH 156/173] spec counter: add spec threshold notifications This allows configuring spec thresholds which a notification will be sent for when reached. Additionally it colors the infobox text red or green based on if the threshold has been reached. Co-authored-by: Dylan Co-authored-by: jgozon <47003557+jgozon@users.noreply.github.com> --- .../specialcounter/SpecialCounter.java | 17 +++- .../specialcounter/SpecialCounterConfig.java | 89 +++++++++++++++++++ .../specialcounter/SpecialCounterPlugin.java | 29 +++++- .../plugins/specialcounter/SpecialWeapon.java | 12 +-- .../SpecialCounterPluginTest.java | 69 +++++++++++++- 5 files changed, 208 insertions(+), 8 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterConfig.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java index eaeb0a0cda..736ae0677c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.specialcounter; +import java.awt.Color; import java.awt.image.BufferedImage; import java.util.HashMap; import java.util.Map; @@ -34,13 +35,15 @@ import net.runelite.client.ui.overlay.infobox.Counter; class SpecialCounter extends Counter { private final SpecialWeapon weapon; + private final SpecialCounterConfig config; @Getter(AccessLevel.PACKAGE) private final Map partySpecs = new HashMap<>(); - SpecialCounter(BufferedImage image, SpecialCounterPlugin plugin, int hitValue, SpecialWeapon weapon) + SpecialCounter(BufferedImage image, SpecialCounterPlugin plugin, SpecialCounterConfig config, int hitValue, SpecialWeapon weapon) { super(image, plugin, hitValue); this.weapon = weapon; + this.config = config; } void addHits(double hit) @@ -90,4 +93,16 @@ class SpecialCounter extends Counter return weapon.getName() + " special has hit " + hitValue + " total."; } } + + @Override + public Color getTextColor() + { + int threshold = weapon.getThreshold().apply(config); + if (threshold > 0) + { + int count = getCount(); + return count >= threshold ? Color.GREEN : Color.RED; + } + return super.getTextColor(); + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterConfig.java new file mode 100644 index 0000000000..4320b59e6c --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterConfig.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2020, Dylan + * Copyright (c) 2020, Jacob + * 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.specialcounter; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("specialcounter") +public interface SpecialCounterConfig extends Config +{ + @ConfigItem( + position = 0, + keyName = "thresholdNotification", + name = "Threshold Notifications", + description = "Sends a notification when your special attack counter exceeds the threshold" + ) + default boolean thresholdNotification() + { + return false; + } + + @ConfigItem( + position = 1, + keyName = "dragonWarhammerThreshold", + name = "Dragon Warhammer", + description = "Threshold for Dragon Warhammer (0 to disable)" + ) + default int dragonWarhammerThreshold() + { + return 0; + } + + @ConfigItem( + position = 2, + keyName = "arclightThreshold", + name = "Arclight", + description = "Threshold for Arclight (0 to disable)" + ) + default int arclightThreshold() + { + return 0; + } + + @ConfigItem( + position = 3, + keyName = "darklightThreshold", + name = "Darklight", + description = "Threshold for Darklight (0 to disable)" + ) + default int darklightThreshold() + { + return 0; + } + + @ConfigItem( + position = 4, + keyName = "bandosGodswordThreshold", + name = "Bandos Godsword", + description = "Threshold for Bandos Godsword (0 to disable)" + ) + default int bandosGodswordThreshold() + { + return 0; + } +} 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 5ca87940ff..799dd098ef 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 @@ -25,6 +25,7 @@ package net.runelite.client.plugins.specialcounter; import com.google.common.collect.ImmutableSet; +import com.google.inject.Provides; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -46,7 +47,9 @@ import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.VarbitChanged; +import net.runelite.client.Notifier; import net.runelite.client.callback.ClientThread; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; @@ -96,6 +99,18 @@ public class SpecialCounterPlugin extends Plugin @Inject private ItemManager itemManager; + @Inject + private Notifier notifier; + + @Inject + private SpecialCounterConfig config; + + @Provides + SpecialCounterConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(SpecialCounterConfig.class); + } + @Override protected void startUp() { @@ -313,7 +328,7 @@ public class SpecialCounterPlugin extends Plugin if (counter == null) { - counter = new SpecialCounter(itemManager.getImage(specialWeapon.getItemID()), this, + counter = new SpecialCounter(itemManager.getImage(specialWeapon.getItemID()), this, config, hit, specialWeapon); infoBoxManager.addInfoBox(counter); specialCounter[specialWeapon.ordinal()] = counter; @@ -323,6 +338,9 @@ public class SpecialCounterPlugin extends Plugin counter.addHits(hit); } + // Display a notification if special attack thresholds are met + sendNotification(specialWeapon, counter); + // If in a party, add hit to partySpecs for the infobox tooltip Map partySpecs = counter.getPartySpecs(); if (!party.getMembers().isEmpty()) @@ -338,6 +356,15 @@ public class SpecialCounterPlugin extends Plugin } } + private void sendNotification(SpecialWeapon weapon, SpecialCounter counter) + { + int threshold = weapon.getThreshold().apply(config); + if (threshold > 0 && counter.getCount() >= threshold && config.thresholdNotification()) + { + notifier.notify(weapon.getName() + " special attack threshold reached!"); + } + } + private void removeCounters() { interactedNpcIds.clear(); 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 69d8d68193..e3cd82cfc6 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 @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.specialcounter; +import java.util.function.Function; import lombok.AllArgsConstructor; import lombok.Getter; import net.runelite.api.ItemID; @@ -32,13 +33,14 @@ import net.runelite.api.ItemID; @Getter enum SpecialWeapon { - DRAGON_WARHAMMER("Dragon Warhammer", ItemID.DRAGON_WARHAMMER, false), - ARCLIGHT("Arclight", ItemID.ARCLIGHT, false), - DARKLIGHT("Darklight", ItemID.DARKLIGHT, false), - BANDOS_GODSWORD("Bandos Godsword", ItemID.BANDOS_GODSWORD, true), - BANDOS_GODSWORD_OR("Bandos Godsword", ItemID.BANDOS_GODSWORD_OR, true); + DRAGON_WARHAMMER("Dragon Warhammer", ItemID.DRAGON_WARHAMMER, false, SpecialCounterConfig::dragonWarhammerThreshold), + 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); private final String name; private final int itemID; private final boolean damage; + private final Function threshold; } \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java index e25f75b6cf..e865688cd4 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/specialcounter/SpecialCounterPluginTest.java @@ -42,6 +42,7 @@ import net.runelite.api.VarPlayer; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.VarbitChanged; +import net.runelite.client.Notifier; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ws.PartyService; @@ -76,6 +77,14 @@ public class SpecialCounterPluginTest @Bind private ItemManager itemManager; + @Mock + @Bind + private Notifier notifier; + + @Mock + @Bind + private SpecialCounterConfig specialCounterConfig; + @Inject private SpecialCounterPlugin specialCounterPlugin; @@ -227,4 +236,62 @@ public class SpecialCounterPluginTest verify(infoBoxManager).removeInfoBox(any(SpecialCounter.class)); } -} \ No newline at end of file + + @Test + public void testNotification() + { + // Create an enemy + NPC target = mock(NPC.class); + + // Create player + Player player = mock(Player.class); + when(client.getLocalPlayer()).thenReturn(player); + when(specialCounterConfig.bandosGodswordThreshold()).thenReturn(2); + when(specialCounterConfig.thresholdNotification()).thenReturn(true); + + // Attack enemy + when(player.getInteracting()).thenReturn(target); + specialCounterPlugin.onInteractingChanged(new InteractingChanged(player, target)); + + // First special attack + when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(50); + specialCounterPlugin.onVarbitChanged(new VarbitChanged()); + specialCounterPlugin.onHitsplatApplied(hitsplat(target, Hitsplat.HitsplatType.DAMAGE_ME)); + + // Second special attack + when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(0); + specialCounterPlugin.onVarbitChanged(new VarbitChanged()); + specialCounterPlugin.onHitsplatApplied(hitsplat(target, Hitsplat.HitsplatType.DAMAGE_ME)); + + verify(notifier).notify("Bandos Godsword special attack threshold reached!"); + } + + @Test + public void testNotificationNotThreshold() + { + // Create an enemy + NPC target = mock(NPC.class); + + // Create player + Player player = mock(Player.class); + when(client.getLocalPlayer()).thenReturn(player); + when(specialCounterConfig.bandosGodswordThreshold()).thenReturn(3); + lenient().when(specialCounterConfig.thresholdNotification()).thenReturn(true); + + // Attack enemy + when(player.getInteracting()).thenReturn(target); + specialCounterPlugin.onInteractingChanged(new InteractingChanged(player, target)); + + // First special attack + when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(50); + specialCounterPlugin.onVarbitChanged(new VarbitChanged()); + specialCounterPlugin.onHitsplatApplied(hitsplat(target, Hitsplat.HitsplatType.DAMAGE_ME)); + + // Second special attack + when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(0); + specialCounterPlugin.onVarbitChanged(new VarbitChanged()); + specialCounterPlugin.onHitsplatApplied(hitsplat(target, Hitsplat.HitsplatType.DAMAGE_ME)); + + verify(notifier, never()).notify(any()); + } +} From fa43ca94dbe97235feb54d4fdce499a6be3f555e Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 8 Jan 2021 17:53:12 -0500 Subject: [PATCH 157/173] npc highlight: revert fill color behavior Prior to ab4cf1afe913879f9d0c1b031d77798b0b6c865e this already accepted an alpha color and so this introduced a behavior change when picking a color with alpha --- .../runelite/client/plugins/npchighlight/NpcSceneOverlay.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java index 3fdaeb114a..441d811a97 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java @@ -48,7 +48,6 @@ 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.OverlayUtil; -import net.runelite.client.util.ColorUtil; import net.runelite.client.util.Text; public class NpcSceneOverlay extends Overlay @@ -200,7 +199,7 @@ public class NpcSceneOverlay extends Overlay graphics.setColor(color); graphics.setStroke(new BasicStroke(2)); graphics.draw(polygon); - graphics.setColor(ColorUtil.colorWithAlpha(color, color.getAlpha() / 12)); + graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); graphics.fill(polygon); } } From 266fee2067bb97cf0a501df08dd2919018bd62fe Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Jan 2021 17:05:20 -0500 Subject: [PATCH 158/173] config service: handle fromJson() returning null Treat it the same as handling a json syntax exception --- .../runelite/http/service/config/ConfigService.java | 11 +++++++++-- .../http/service/config/ConfigServiceTest.java | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java index 7c3f5c37b3..6c48a60277 100644 --- a/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java +++ b/http-service/src/main/java/net/runelite/http/service/config/ConfigService.java @@ -233,8 +233,11 @@ public class ConfigService try { jsonValue = RuneLiteAPI.GSON.fromJson(value, Object.class); - - if (jsonValue instanceof Double || jsonValue instanceof Float) + if (jsonValue == null) + { + return value; + } + else if (jsonValue instanceof Double || jsonValue instanceof Float) { Number number = (Number) jsonValue; if (Math.floor(number.doubleValue()) == number.doubleValue() && !Double.isInfinite(number.doubleValue())) @@ -272,6 +275,10 @@ public class ConfigService { // I couldn't figure out a better way to do this than a second json parse JsonElement jsonElement = RuneLiteAPI.GSON.fromJson(value, JsonElement.class); + if (jsonElement == null) + { + return value.length() < MAX_VALUE_LENGTH; + } return validateObject(jsonElement, 1); } catch (JsonSyntaxException ex) diff --git a/http-service/src/test/java/net/runelite/http/service/config/ConfigServiceTest.java b/http-service/src/test/java/net/runelite/http/service/config/ConfigServiceTest.java index 64c4ef574c..e74eb4d4fa 100644 --- a/http-service/src/test/java/net/runelite/http/service/config/ConfigServiceTest.java +++ b/http-service/src/test/java/net/runelite/http/service/config/ConfigServiceTest.java @@ -51,5 +51,6 @@ public class ConfigServiceTest assertTrue(ConfigService.validateJson("\"test\"")); assertTrue(ConfigService.validateJson("key:value")); assertTrue(ConfigService.validateJson("{\"key\": \"value\"}")); + assertTrue(ConfigService.validateJson("\n")); } } \ No newline at end of file From 359b909d8e29ebe2b2589aefd74b7159715b805e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 9 Jan 2021 21:32:47 -0500 Subject: [PATCH 159/173] gpu: fix camera position The position returned by getCameraX/Y/Z are not yet updated when this is called, causing it to be from the previous frame's camera position. This was introduced in 0fc1a940887a835df29f3615fbedde15684eed03 when the uniform code was copied from draw. --- .../java/net/runelite/client/plugins/gpu/GpuPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 826f95fd47..a6be4e5872 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -793,9 +793,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks .put(client.getCenterX()) .put(client.getCenterY()) .put(client.getScale()) - .put(client.getCameraX2()) - .put(client.getCameraY2()) - .put(client.getCameraZ2()); + .put(cameraX) + .put(cameraY) + .put(cameraZ); uniformBuffer.flip(); gl.glBufferSubData(gl.GL_UNIFORM_BUFFER, 0, uniformBuffer.limit() * Integer.BYTES, uniformBuffer); From 58d53d1a627d218597f4f83cb36876984dbb0ff0 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 10 Jan 2021 18:22:18 -0700 Subject: [PATCH 160/173] runelite-api: add Preferences::getHideUsername() --- runelite-api/src/main/java/net/runelite/api/Preferences.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Preferences.java b/runelite-api/src/main/java/net/runelite/api/Preferences.java index d7b67242bf..5925c1c764 100644 --- a/runelite-api/src/main/java/net/runelite/api/Preferences.java +++ b/runelite-api/src/main/java/net/runelite/api/Preferences.java @@ -66,4 +66,9 @@ public interface Preferences * @param volume 0-127 inclusive */ void setAreaSoundEffectVolume(int volume); + + /** + * Gets if the login name should be replaced with asterisks + */ + boolean getHideUsername(); } From 75042fc2a3b6bb606c0d94222818ad14c8ded971 Mon Sep 17 00:00:00 2001 From: Zach Date: Mon, 11 Jan 2021 17:44:38 -0600 Subject: [PATCH 161/173] itemstats: Fix Zamorak brew defence drain amount (#12921) --- .../net/runelite/client/plugins/itemstats/ItemStatChanges.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java index a5dc493f5b..e25bab08c4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java @@ -131,7 +131,7 @@ public class ItemStatChanges add(boost(DEFENCE, perc(.15, 5)), SUPER_DEFENCE1, SUPER_DEFENCE2, SUPER_DEFENCE3, SUPER_DEFENCE4); add(boost(MAGIC, 3), MAGIC_ESSENCE1, MAGIC_ESSENCE2, MAGIC_ESSENCE3, MAGIC_ESSENCE4); add(combo(3, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5))), SUPER_COMBAT_POTION1, SUPER_COMBAT_POTION2, SUPER_COMBAT_POTION3, SUPER_COMBAT_POTION4); - add(combo(3, boost(ATTACK, perc(.20, 2)), boost(STRENGTH, perc(.12, 2)), heal(PRAYER, perc(.10, 0)), heal(DEFENCE, perc(.10, -2)), new BoostedStatBoost(HITPOINTS, false, perc(-.12, 0))), ZAMORAK_BREW1, ZAMORAK_BREW2, ZAMORAK_BREW3, ZAMORAK_BREW4); + add(combo(3, boost(ATTACK, perc(.20, 2)), boost(STRENGTH, perc(.12, 2)), heal(PRAYER, perc(.10, 0)), new BoostedStatBoost(DEFENCE, false, perc(.10, -2)), new BoostedStatBoost(HITPOINTS, false, perc(-.12, 0))), ZAMORAK_BREW1, ZAMORAK_BREW2, ZAMORAK_BREW3, ZAMORAK_BREW4); add(new SaradominBrew(0.15, 0.2, 0.1, 2, 2), SARADOMIN_BREW1, SARADOMIN_BREW2, SARADOMIN_BREW3, SARADOMIN_BREW4); add(boost(RANGED, perc(.15, 5)), SUPER_RANGING_1, SUPER_RANGING_2, SUPER_RANGING_3, SUPER_RANGING_4); add(boost(MAGIC, perc(.15, 5)), SUPER_MAGIC_POTION_1, SUPER_MAGIC_POTION_2, SUPER_MAGIC_POTION_3, SUPER_MAGIC_POTION_4); From e5ccde56ed1dce04c6a000a29869e24a9e8ea838 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Mon, 11 Jan 2021 15:52:34 -0800 Subject: [PATCH 162/173] HotColdLocation: Fix Pirates' Cove spot Ref: #9601 --- .../plugins/cluescrolls/clues/hotcold/HotColdLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java index b624e206a2..02ef88a083 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java @@ -91,7 +91,7 @@ public enum HotColdLocation FREMENNIK_PROVINCE_FREMMY_ISLES_MINE(new WorldPoint(2374, 3850, 0), FREMENNIK_PROVINCE, "Central Fremennik Isles mine.", ANCIENT_WIZARDS), FREMENNIK_PROVINCE_WEST_ISLES_MINE(new WorldPoint(2313, 3850, 0), FREMENNIK_PROVINCE, "West Fremennik Isles mine.", ANCIENT_WIZARDS), FREMENNIK_PROVINCE_WEST_JATIZSO_ENTRANCE(new WorldPoint(2393, 3812, 0), FREMENNIK_PROVINCE, "West of the Jatizso mine entrance.", BRASSICAN_MAGE), - FREMENNIK_PROVINCE_PIRATES_COVE(new WorldPoint(2210, 3814, 0), FREMENNIK_PROVINCE, "Pirates' Cove", ANCIENT_WIZARDS), + FREMENNIK_PROVINCE_PIRATES_COVE(new WorldPoint(2211, 3817, 0), FREMENNIK_PROVINCE, "Pirates' Cove", ANCIENT_WIZARDS), FREMENNIK_PROVINCE_ASTRAL_ALTER(new WorldPoint(2149, 3865, 0), FREMENNIK_PROVINCE, "Astral altar", ANCIENT_WIZARDS), FREMENNIK_PROVINCE_LUNAR_VILLAGE(new WorldPoint(2084, 3916, 0), FREMENNIK_PROVINCE, "Lunar Isle, inside the village.", ANCIENT_WIZARDS), FREMENNIK_PROVINCE_LUNAR_NORTH(new WorldPoint(2106, 3949, 0), FREMENNIK_PROVINCE, "Lunar Isle, north of the village.", ANCIENT_WIZARDS), From 1caaf920fe2b6232e4ab03ce4e85ef637df3b974 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Fri, 28 Aug 2020 20:41:20 -0400 Subject: [PATCH 163/173] worldmap: add Mahogany Homes minigame locations --- .../runelite/client/plugins/worldmap/MinigameLocation.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java index a7145c8ee9..90b54a47c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java @@ -71,7 +71,11 @@ enum MinigameLocation CATAPULT_ROOM("Catapult Room", new WorldPoint(2842, 3545, 0)), SHOT_PUT_ROOM("Shot Put Room", new WorldPoint(2863, 3550, 0)), HALLOWED_SEPULCHRE("Hallowed Sepulchre", new WorldPoint(3653, 3386, 1)), - THE_GAUNTLET("The Gauntlet", new WorldPoint(3223, 12505, 1)); + THE_GAUNTLET("The Gauntlet", new WorldPoint(3223, 12505, 1)), + MAHOGANY_HOMES_ARDOUGNE("Mahogany Homes", new WorldPoint(2634, 3295, 0)), + MAHOGANY_HOMES_FALADOR("Mahogany Homes", new WorldPoint(2989, 3363, 0)), + MAHOGANY_HOMES_HOSIDIUS("Mahogany Homes", new WorldPoint(1780, 3623, 0)), + MAHOGANY_HOMES_VARROCK("Mahogany Homes", new WorldPoint(3240, 3471, 0)); private final String tooltip; private final WorldPoint location; From 4edf1e19dbe94bdb4e2bcac7f331cd4966e9218b Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Mon, 11 Jan 2021 21:31:26 -0500 Subject: [PATCH 164/173] worldmap: add Soul Wars minigame and teleport locations --- .../runelite/client/plugins/worldmap/MinigameLocation.java | 4 +++- .../client/plugins/worldmap/TransportationPointLocation.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java index 90b54a47c3..a5f0b55ca0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java @@ -75,7 +75,9 @@ enum MinigameLocation MAHOGANY_HOMES_ARDOUGNE("Mahogany Homes", new WorldPoint(2634, 3295, 0)), MAHOGANY_HOMES_FALADOR("Mahogany Homes", new WorldPoint(2989, 3363, 0)), MAHOGANY_HOMES_HOSIDIUS("Mahogany Homes", new WorldPoint(1780, 3623, 0)), - MAHOGANY_HOMES_VARROCK("Mahogany Homes", new WorldPoint(3240, 3471, 0)); + MAHOGANY_HOMES_VARROCK("Mahogany Homes", new WorldPoint(3240, 3471, 0)), + SOUL_WARS("Soul Wars", new WorldPoint(2209, 2855, 0)), + SOUL_WARS_EDGEVILLE_PORTAL("Soul Wars", new WorldPoint(3082, 3474, 0)); private final String tooltip; private final WorldPoint location; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java index d7a683076e..3d3913a304 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java @@ -192,6 +192,7 @@ enum TransportationPointLocation MUSHTREE_TAR_SWAMP("Mushtree", new WorldPoint(3676, 3755, 0)), MUSHTREE_VERDANT_VALLEY("Mushtree", new WorldPoint(3757, 3756, 0)), MYTHS_GUILD_PORTAL("Portal to Guilds", new WorldPoint(2456, 2856, 0)), + SOUL_WARS_PORTAL("Portal to Edgeville/Ferox Enclave", new WorldPoint(2204, 2858, 0)), TRAIN_KELDAGRIM("Railway Station", new WorldPoint(2941, 10179, 0)), WILDERNESS_LEVER_ARDOUGNE("Wilderness Lever to Deserted Keep", new WorldPoint(2559, 3309, 0), new WorldPoint(3154, 3924, 0)), WILDERNESS_LEVER_EDGEVILLE("Wilderness Lever to Deserted Keep", new WorldPoint(3088, 3474, 0), new WorldPoint(3154, 3924, 0)), From b9ee906d918f8322f65886e3ca26b05eea976d1d Mon Sep 17 00:00:00 2001 From: Nick <6614021+sonofachamp@users.noreply.github.com> Date: Tue, 12 Jan 2021 01:36:10 -0600 Subject: [PATCH 165/173] CrypticClue: Include Varrock armour in Head chef clue solution (#13029) --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 9360b6aa33..b263571fee 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -105,7 +105,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("A crate found in the tower of a church is your next location.", CRATE_357, new WorldPoint(2612, 3304, 1), "Climb the ladder and search the crates on the first floor in the Church in Ardougne."), new CrypticClue("Covered in shadows, the centre of the circle is where you will find the answer.", new WorldPoint(3488, 3289, 0), "Dig in the centre of Mort'ton, where the roads intersect."), new CrypticClue("I lie lonely and forgotten in mid wilderness, where the dead rise from their beds. Feel free to quarrel and wind me up, and dig while you shoot their heads.", new WorldPoint(3174, 3663, 0), "Directly under the crossbow respawn in the Graveyard of Shadows in level 18 Wilderness."), - new CrypticClue("In the city where merchants are said to have lived, talk to a man with a splendid cape, but a hat dropped by goblins.", "Head chef", new WorldPoint(3143, 3445, 0), "Talk to the Head chef in Cooks' Guild west of Varrock. You will need a chef hat or cooking cape to enter."), + new CrypticClue("In the city where merchants are said to have lived, talk to a man with a splendid cape, but a hat dropped by goblins.", "Head chef", new WorldPoint(3143, 3445, 0), "Talk to the Head chef in Cooks' Guild west of Varrock. You will need a chef's hat, Varrock armour 3 or 4, or the Cooking cape to enter."), new CrypticClue("The mother of the reptilian sacrifice.", "Zul-Cheray", new WorldPoint(2204, 3050, 0), "Talk to Zul-Cheray in a house near the sacrificial boat at Zul-Andra."), new CrypticClue("I watch the sea. I watch you fish. I watch your tree.", "Ellena", new WorldPoint(2860, 3431, 0), "Speak to Ellena at Catherby fruit tree patch."), new CrypticClue("Dig between some ominous stones in Falador.", new WorldPoint(3040, 3399, 0), "Three standing stones inside a walled area. East of the northern Falador gate."), From f69f1af9b064681fef38b5929192bb18cf434335 Mon Sep 17 00:00:00 2001 From: Nick Wolff Date: Tue, 12 Jan 2021 02:43:27 -0500 Subject: [PATCH 166/173] clues: Allow Dragon scimitar (or) for Falo the bard step (#13032) --- .../client/plugins/cluescrolls/clues/FaloTheBardClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java index 77910ab61d..1c41057a0a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java @@ -50,7 +50,7 @@ import net.runelite.client.ui.overlay.components.TitleComponent; public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcClueScroll { private static final List CLUES = ImmutableList.of( - new FaloTheBardClue("A blood red weapon, a strong curved sword, found on the island of primate lords.", item(DRAGON_SCIMITAR)), + new FaloTheBardClue("A blood red weapon, a strong curved sword, found on the island of primate lords.", any("Dragon scimitar", item(DRAGON_SCIMITAR), item(DRAGON_SCIMITAR_OR))), new FaloTheBardClue("A book that preaches of some great figure, lending strength, might and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))), new FaloTheBardClue("A bow of elven craft was made, it shimmers bright, but will soon fade.", any("Crystal Bow", item(CRYSTAL_BOW), item(CRYSTAL_BOW_24123))), new FaloTheBardClue("A fiery axe of great inferno, when you use it, you'll wonder where the logs go.", item(INFERNAL_AXE)), From 3a1784c236847b67df69d0039aab27adff6f4417 Mon Sep 17 00:00:00 2001 From: JZomerlei Date: Tue, 12 Jan 2021 14:01:39 -0500 Subject: [PATCH 167/173] Update Quest Enum to latest cache (#12999) --- runelite-api/src/main/java/net/runelite/api/Quest.java | 4 ++-- .../achievementdiary/diaries/KaramjaDiaryRequirement.java | 4 ++-- .../runelite/client/plugins/worldmap/QuestStartLocation.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Quest.java b/runelite-api/src/main/java/net/runelite/api/Quest.java index c06ed30dff..cf87417d00 100644 --- a/runelite-api/src/main/java/net/runelite/api/Quest.java +++ b/runelite-api/src/main/java/net/runelite/api/Quest.java @@ -36,7 +36,7 @@ public enum Quest THE_CORSAIR_CURSE(301, "The Corsair Curse"), DEMON_SLAYER(302, "Demon Slayer"), DORICS_QUEST(303, "Doric's Quest"), - DRAGON_SLAYER(304, "Dragon Slayer"), + DRAGON_SLAYER_I(304, "Dragon Slayer I"), ERNEST_THE_CHICKEN(305, "Ernest the Chicken"), GOBLIN_DIPLOMACY(306, "Goblin Diplomacy"), IMP_CATCHER(307, "Imp Catcher"), @@ -133,7 +133,7 @@ public enum Quest PLAGUE_CITY(407, "Plague City"), PRIEST_IN_PERIL(408, "Priest in Peril"), THE_QUEEN_OF_THIEVES(409, "The Queen of Thieves"), - RAG_AND_BONE_MAN(410, "Rag and Bone Man"), + RAG_AND_BONE_MAN_I(410, "Rag and Bone Man I"), RAG_AND_BONE_MAN_II(411, "Rag and Bone Man II"), RATCATCHERS(412, "Ratcatchers"), RECIPE_FOR_DISASTER(413, "Recipe for Disaster"), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java index fc906cccb4..acdae10ce3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java @@ -50,9 +50,9 @@ public class KaramjaDiaryRequirement extends GenericDiaryRequirement add("Claim a ticket from the Agility Arena in Brimhaven.", new SkillRequirement(Skill.AGILITY, 30)); add("Discover hidden wall in the dungeon below the volcano.", - new QuestRequirement(Quest.DRAGON_SLAYER, true)); + new QuestRequirement(Quest.DRAGON_SLAYER_I, true)); add("Visit the Isle of Crandor via the dungeon below the volcano.", - new QuestRequirement(Quest.DRAGON_SLAYER, true)); + new QuestRequirement(Quest.DRAGON_SLAYER_I, true)); add("Use Vigroy and Hajedy's cart service.", new QuestRequirement(Quest.SHILO_VILLAGE)); add("Earn 100% favour in the village of Tai Bwo Wannai.", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index bf4c69b756..f731d20e9a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -38,7 +38,7 @@ enum QuestStartLocation THE_CORSAIR_CURSE(Quest.THE_CORSAIR_CURSE, new WorldPoint(3029, 3273, 0)), DEMON_SLAYER(Quest.DEMON_SLAYER, new WorldPoint(3204, 3424, 0)), DORICS_QUEST(Quest.DORICS_QUEST, new WorldPoint(2952, 3450, 0)), - DRAGON_SLAYER(Quest.DRAGON_SLAYER, new WorldPoint(3190, 3362, 0)), + DRAGON_SLAYER_I(Quest.DRAGON_SLAYER_I, new WorldPoint(3190, 3362, 0)), ERNEST_THE_CHICKEN(Quest.ERNEST_THE_CHICKEN, new WorldPoint(3109, 3330, 0)), GOBLIN_DIPLOMACY(Quest.GOBLIN_DIPLOMACY, new WorldPoint(2957, 3509, 0)), IMP_CATCHER(Quest.IMP_CATCHER, new WorldPoint(3108, 3160, 0)), @@ -136,7 +136,7 @@ enum QuestStartLocation A_PORCINE_OF_INTEREST(Quest.A_PORCINE_OF_INTEREST, new WorldPoint(3085, 3251, 0)), PRIEST_IN_PERIL(Quest.PRIEST_IN_PERIL, new WorldPoint(3219, 3473, 0)), THE_QUEEN_OF_THIEVES(Quest.THE_QUEEN_OF_THIEVES, new WorldPoint(1795, 3782, 0)), - RAG_AND_BONE_MAN(new Quest[]{Quest.RAG_AND_BONE_MAN, Quest.RAG_AND_BONE_MAN_II}, new WorldPoint(3359, 3504, 0)), + RAG_AND_BONE_MAN_I(new Quest[]{Quest.RAG_AND_BONE_MAN_I, Quest.RAG_AND_BONE_MAN_II}, new WorldPoint(3359, 3504, 0)), RECRUITMENT_DRIVE_BLACK_KNIGHTS_FORTRESS(new Quest[]{Quest.BLACK_KNIGHTS_FORTRESS, Quest.RECRUITMENT_DRIVE}, new WorldPoint(2959, 3336, 0)), ROVING_ELVES(Quest.ROVING_ELVES, new WorldPoint(2288, 3146, 0)), RUM_DEAL(Quest.RUM_DEAL, new WorldPoint(3679, 3535, 0)), From a26908cb6d6407a78bb49f00914120c9f46d51d0 Mon Sep 17 00:00:00 2001 From: Broooklyn <54762282+Broooklyn@users.noreply.github.com> Date: Fri, 8 Jan 2021 15:47:45 -0500 Subject: [PATCH 168/173] itemstats: Add Soul Wars Potion of Power and Bandages --- .../runelite/client/plugins/itemstats/ItemStatChanges.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java index e25bab08c4..1a6d4677e7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java @@ -214,6 +214,10 @@ public class ItemStatChanges add(heal(HITPOINTS, 20), PADDLEFISH); add(new GauntletPotion(), EGNIOL_POTION_1, EGNIOL_POTION_2, EGNIOL_POTION_3, EGNIOL_POTION_4); + // Soul Wars + add(combo(2, heal(HITPOINTS, perc(.20, 2)), heal(RUN_ENERGY, 100)), BANDAGES_25202); + add(combo(6, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5)), boost(RANGED, perc(.15, 5)), boost(MAGIC, perc(.15, 5)), heal(PRAYER, perc(.25, 8))), POTION_OF_POWER1, POTION_OF_POWER2, POTION_OF_POWER3, POTION_OF_POWER4); + log.debug("{} items; {} behaviours loaded", effects.size(), new HashSet<>(effects.values()).size()); } From 8cc7448f58f62c28d752d4717af840499405f6f5 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 13 Jan 2021 10:58:17 -0500 Subject: [PATCH 169/173] runelite config: enable custom chrome only on Windows --- .../main/java/net/runelite/client/config/RuneLiteConfig.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java index dfa1583135..c56f4a9995 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java @@ -32,6 +32,7 @@ import net.runelite.api.Constants; import net.runelite.client.Notifier; import net.runelite.client.ui.ContainableFrame; import net.runelite.client.ui.overlay.components.ComponentConstants; +import net.runelite.client.util.OSType; @ConfigGroup(RuneLiteConfig.GROUP_NAME) public interface RuneLiteConfig extends Config @@ -122,14 +123,14 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "uiEnableCustomChrome", name = "Enable custom window chrome", - description = "Use Runelite's custom window title and borders.", + description = "Use RuneLite's custom window title and borders.", warning = "Please restart your client after changing this setting", position = 15, section = windowSettings ) default boolean enableCustomChrome() { - return true; + return OSType.getOSType() == OSType.Windows; } @Range( From 92013816b856cf68233aefcff04354884d746caa Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 13 Jan 2021 16:02:08 -0500 Subject: [PATCH 170/173] Shorten many config names to fit into side panel --- .../client/config/RuneLiteConfig.java | 18 ++++---- .../client/plugins/agility/AgilityConfig.java | 2 +- .../client/plugins/boosts/BoostsConfig.java | 6 +-- .../client/plugins/cannon/CannonConfig.java | 6 +-- .../plugins/chatfilter/ChatFilterConfig.java | 2 +- .../plugins/driftnet/DriftNetConfig.java | 2 +- .../client/plugins/fishing/FishingConfig.java | 4 +- .../grounditems/GroundItemsConfig.java | 24 +++++----- .../idlenotifier/IdleNotifierConfig.java | 10 ++--- .../plugins/implings/ImplingsConfig.java | 24 +++++----- .../plugins/itemcharges/ItemChargeConfig.java | 36 +++++++-------- .../opponentinfo/OpponentInfoConfig.java | 2 +- .../PlayerIndicatorsConfig.java | 10 ++--- .../client/plugins/prayer/PrayerConfig.java | 2 +- .../pyramidplunder/PyramidPlunderConfig.java | 6 +-- .../client/plugins/raids/RaidsConfig.java | 14 +++--- .../plugins/regenmeter/RegenMeterConfig.java | 4 +- .../plugins/statusbars/StatusBarsConfig.java | 4 +- .../tileindicators/TileIndicatorsConfig.java | 26 ++++++----- .../timetracking/TimeTrackingConfig.java | 2 +- .../plugins/wintertodt/WintertodtConfig.java | 4 +- .../plugins/worldmap/WorldMapConfig.java | 44 +++++++++---------- 22 files changed, 129 insertions(+), 123 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java index c56f4a9995..36b3084946 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java @@ -151,7 +151,7 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "gameAlwaysOnTop", - name = "Enable client always on top", + name = "Always on top", description = "The game will always be on the top of the screen", position = 17, section = windowSettings @@ -163,8 +163,8 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "warningOnExit", - name = "Display warning on exit", - description = "Toggles a warning popup when trying to exit the client", + name = "Exit warning", + description = "Shows a warning popup when trying to exit the client", position = 18, section = windowSettings ) @@ -199,7 +199,7 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "notificationRequestFocus", - name = "Request focus on notification", + name = "Request focus", description = "Configures the window focus request type on notification", position = 21, section = notificationSettings @@ -223,8 +223,8 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "notificationGameMessage", - name = "Enable game message notifications", - description = "Puts a notification message in the chatbox", + name = "Game message notifications", + description = "Adds a notification message to the chatbox", position = 23, section = notificationSettings ) @@ -235,7 +235,7 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "flashNotification", - name = "Flash notification", + name = "Flash", description = "Flashes the game frame as a notification", position = 24, section = notificationSettings @@ -260,7 +260,7 @@ public interface RuneLiteConfig extends Config @Alpha @ConfigItem( keyName = "notificationFlashColor", - name = "Notification Flash Color", + name = "Notification Flash", description = "Sets the color of the notification flashes.", position = 26, section = notificationSettings @@ -296,7 +296,7 @@ public interface RuneLiteConfig extends Config @ConfigItem( keyName = "interfaceFontType", - name = "Interface Overlay Font", + name = "Interface Font", description = "Configures what font type is used for in-game interface overlays such as panels, opponent info, clue scrolls etc.", position = 32, section = overlaySettings diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java index a5ba1dca42..c68530ec95 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java @@ -147,7 +147,7 @@ public interface AgilityConfig extends Config @Alpha @ConfigItem( keyName = "portalsHighlight", - name = "Portals Highlight Color", + name = "Portals Color", description = "Color of highlighted Prifddinas portals", position = 9 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java index dbb0d6d731..91cec5c09c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java @@ -81,7 +81,7 @@ public interface BoostsConfig extends Config @ConfigItem( keyName = "displayNextBuffChange", - name = "Display next buff change", + name = "Next buff change", description = "Configures whether or not to display when the next buffed stat change will be", position = 4 ) @@ -92,7 +92,7 @@ public interface BoostsConfig extends Config @ConfigItem( keyName = "displayNextDebuffChange", - name = "Display next debuff change", + name = "Next debuff change", description = "Configures whether or not to display when the next debuffed stat change will be", position = 5 ) @@ -103,7 +103,7 @@ public interface BoostsConfig extends Config @ConfigItem( keyName = "boostThreshold", - name = "Boost amount threshold", + name = "Boost threshold", description = "The threshold at which boosted levels will be displayed in a different color. A value of 0 will disable the feature.", position = 6 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java index 05ba93da2e..3ae29b0338 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java @@ -51,7 +51,7 @@ public interface CannonConfig extends Config ) @ConfigItem( keyName = "lowWarningThreshold", - name = "Low Warning Threshold", + name = "Low warning threshold", description = "Configures the number of cannonballs remaining before a notification is sent.
    Regardless of this value, a notification will still be sent when your cannon is empty.", position = 2 ) @@ -62,7 +62,7 @@ public interface CannonConfig extends Config @ConfigItem( keyName = "showInfobox", - name = "Show Cannonball infobox", + name = "Show cannonball infobox", description = "Configures whether to show the cannonballs in an infobox", position = 3 ) @@ -85,7 +85,7 @@ public interface CannonConfig extends Config @Alpha @ConfigItem( keyName = "highlightDoubleHitColor", - name = "Color of double hit spots", + name = "Double hit spots", description = "Configures the highlight color of double hit spots", position = 5 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java index 2b9a45c2e9..0ad1071f9d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java @@ -156,7 +156,7 @@ public interface ChatFilterConfig extends Config @ConfigItem( keyName = "maxRepeatedPublicChats", - name = "Max repeated public chats", + name = "Repeat filter", description = "Block player chat message if repeated this many times. 0 is off", position = 11 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java index a977ab3890..c7462819c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/driftnet/DriftNetConfig.java @@ -99,7 +99,7 @@ public interface DriftNetConfig extends Config @ConfigItem( keyName = "tagAnnette", - name = "Tag Annette when no nets in inventory", + name = "Tag Annette", description = "Tag Annette when no nets in inventory", position = 6 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java index e5a1bca65b..e48d80edbd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java @@ -93,7 +93,7 @@ public interface FishingConfig extends Config @Alpha @ConfigItem( keyName = "minnowsOverlayColor", - name = "Minnows Overlay Color", + name = "Minnows Overlay", description = "Color of overlays for Minnows", position = 5 ) @@ -105,7 +105,7 @@ public interface FishingConfig extends Config @Alpha @ConfigItem( keyName = "aerialOverlayColor", - name = "Aerial Overlay Color", + name = "Aerial Overlay", description = "Color of overlays when 1-tick aerial fishing", position = 6 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java index 6540aa6e80..96f454cd1c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java @@ -156,7 +156,7 @@ public interface GroundItemsConfig extends Config @ConfigItem( keyName = "notifyTier", - name = "Notify >= Tier", + name = "Notify tier", description = "Configures which price tiers will trigger a notification on drop", position = 8 ) @@ -211,7 +211,7 @@ public interface GroundItemsConfig extends Config @ConfigItem( keyName = "hideUnderValue", - name = "Hide < Value", + name = "Hide under value", description = "Configures hidden ground items under both GE and HA value", position = 13 ) @@ -223,7 +223,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "defaultColor", - name = "Default items color", + name = "Default items", description = "Configures the color for default, non-highlighted items", position = 14 ) @@ -235,7 +235,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "highlightedColor", - name = "Highlighted items color", + name = "Highlighted items", description = "Configures the color for highlighted items", position = 15 ) @@ -247,7 +247,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "hiddenColor", - name = "Hidden items color", + name = "Hidden items", description = "Configures the color for hidden items in right-click menu and when holding ALT", position = 16 ) @@ -259,7 +259,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "lowValueColor", - name = "Low value items color", + name = "Low value items", description = "Configures the color for low value items", position = 17 ) @@ -282,7 +282,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "mediumValueColor", - name = "Medium value items color", + name = "Medium value items", description = "Configures the color for medium value items", position = 19 ) @@ -305,7 +305,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "highValueColor", - name = "High value items color", + name = "High value items", description = "Configures the color for high value items", position = 21 ) @@ -328,7 +328,7 @@ public interface GroundItemsConfig extends Config @Alpha @ConfigItem( keyName = "insaneValueColor", - name = "Insane value items color", + name = "Insane value items", description = "Configures the color for insane value items", position = 23 ) @@ -361,8 +361,8 @@ public interface GroundItemsConfig extends Config @ConfigItem( keyName = "doubleTapDelay", - name = "Delay for double-tap ALT to hide", - description = "Decrease this number if you accidentally hide ground items often. (0 = Disabled)", + name = "Double-tap delay", + description = "Delay for the double-tap ALT to hide ground items. 0 to disable.", position = 26 ) @Units(Units.MILLISECONDS) @@ -373,7 +373,7 @@ public interface GroundItemsConfig extends Config @ConfigItem( keyName = "collapseEntries", - name = "Collapse ground item menu entries", + name = "Collapse ground item menu", description = "Collapses ground item menu entries together and appends count", position = 27 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java index 564cbb609b..b7ab769756 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java @@ -90,7 +90,7 @@ public interface IdleNotifierConfig extends Config @ConfigItem( keyName = "hitpoints", - name = "Hitpoints Notification Threshold", + name = "Hitpoints Threshold", description = "The amount of hitpoints to send a notification at. A value of 0 will disable notification.", position = 6 ) @@ -101,7 +101,7 @@ public interface IdleNotifierConfig extends Config @ConfigItem( keyName = "prayer", - name = "Prayer Notification Threshold", + name = "Prayer Threshold", description = "The amount of prayer points to send a notification at. A value of 0 will disable notification.", position = 7 ) @@ -112,7 +112,7 @@ public interface IdleNotifierConfig extends Config @ConfigItem( keyName = "oxygen", - name = "Oxygen Notification Threshold", + name = "Oxygen Threshold", position = 8, description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification." ) @@ -124,9 +124,9 @@ public interface IdleNotifierConfig extends Config @ConfigItem( keyName = "spec", - name = "Special Attack Energy Notification Threshold", + name = "Spec Threshold", position = 9, - description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification." + description = "The amount of special attack energy reached to send a notification at. A value of 0 will disable notification." ) @Units(Units.PERCENT) default int getSpecEnergyThreshold() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java index 9fe7e56fb9..a11ef6f7df 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java @@ -55,7 +55,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 1, keyName = "showbaby", - name = "Show Baby implings", + name = "Baby implings", description = "Configures whether or not Baby impling tags are displayed", section = implingSection ) @@ -80,7 +80,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 3, keyName = "showyoung", - name = "Show Young implings", + name = "Young implings", description = "Configures whether or not Young impling tags are displayed", section = implingSection ) @@ -105,7 +105,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 5, keyName = "showgourmet", - name = "Show Gourmet implings", + name = "Gourmet implings", description = "Configures whether or not Gourmet impling tags are displayed", section = implingSection ) @@ -130,7 +130,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 7, keyName = "showearth", - name = "Show Earth implings", + name = "Earth implings", description = "Configures whether or not Earth impling tags are displayed", section = implingSection ) @@ -155,7 +155,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 9, keyName = "showessence", - name = "Show Essence implings", + name = "Essence implings", description = "Configures whether or not Essence impling tags are displayed", section = implingSection ) @@ -180,7 +180,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 11, keyName = "showeclectic", - name = "Show Eclectic implings", + name = "Eclectic implings", description = "Configures whether or not Eclectic impling tags are displayed", section = implingSection ) @@ -205,7 +205,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 13, keyName = "shownature", - name = "Show Nature implings", + name = "Nature implings", description = "Configures whether or not Nature impling tags are displayed", section = implingSection ) @@ -230,7 +230,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 15, keyName = "showmagpie", - name = "Show Magpie implings", + name = "Magpie implings", description = "Configures whether or not Magpie impling tags are displayed", section = implingSection ) @@ -255,7 +255,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 17, keyName = "showninja", - name = "Show Ninja implings", + name = "Ninja implings", description = "Configures whether or not Ninja impling tags are displayed", section = implingSection ) @@ -280,7 +280,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 19, keyName = "showCrystal", - name = "Show Crystal implings", + name = "Crystal implings", description = "Configures whether or not Crystal implings are displayed", section = implingSection ) @@ -305,7 +305,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 21, keyName = "showdragon", - name = "Show Dragon implings", + name = "Dragon implings", description = "Configures whether or not Dragon impling tags are displayed", section = implingSection ) @@ -330,7 +330,7 @@ public interface ImplingsConfig extends Config @ConfigItem( position = 23, keyName = "showlucky", - name = "Show Lucky implings", + name = "Lucky implings", description = "Configures whether or not Lucky impling tags are displayed", section = implingSection ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index 0e8a4569fe..b998251ccb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -51,7 +51,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "veryLowWarningColor", - name = "Very Low Warning Color", + name = "Very Low Warning", description = "The color of the overlay when charges are very low", position = 1 ) @@ -62,7 +62,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "lowWarningColor", - name = "Low Warning Color", + name = "Low Warning", description = "The color of the overlay when charges are low", position = 2 ) @@ -95,7 +95,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showTeleportCharges", - name = "Show Teleport Charges", + name = "Teleport Charges", description = "Show teleport item charge counts", position = 5, section = chargesSection @@ -149,7 +149,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showImpCharges", - name = "Show Imp-in-a-box charges", + name = "Imp-in-a-box charges", description = "Show Imp-in-a-box item charges", position = 8, section = chargesSection @@ -161,7 +161,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showFungicideCharges", - name = "Show Fungicide Charges", + name = "Fungicide Charges", description = "Show Fungicide item charges", position = 9, section = chargesSection @@ -173,7 +173,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showWateringCanCharges", - name = "Show Watering Can Charges", + name = "Watering Can Charges", description = "Show Watering can item charges", position = 10, section = chargesSection @@ -185,7 +185,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showWaterskinCharges", - name = "Show Waterskin Charges", + name = "Waterskin Charges", description = "Show Waterskin dose counts", position = 11, section = chargesSection @@ -197,7 +197,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showBellowCharges", - name = "Show Bellows Charges", + name = "Bellows Charges", description = "Show Ogre bellows item charges", position = 12, section = chargesSection @@ -209,7 +209,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showBasketCharges", - name = "Show Basket Charges", + name = "Basket Charges", description = "Show Fruit basket item counts", position = 13, section = chargesSection @@ -221,7 +221,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showSackCharges", - name = "Show Sack Charges", + name = "Sack Charges", description = "Show Sack item counts", position = 14, section = chargesSection @@ -233,7 +233,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showAbyssalBraceletCharges", - name = "Show Abyssal Bracelet Charges", + name = "Abyssal Bracelet Charges", description = "Show Abyssal bracelet item charges", position = 15, section = chargesSection @@ -245,7 +245,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showAmuletOfChemistryCharges", - name = "Show Amulet of Chemistry Charges", + name = "Amulet of Chemistry Charges", description = "Show Amulet of chemistry item charges", position = 16, section = chargesSection @@ -275,7 +275,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showAmuletOfBountyCharges", - name = "Show Amulet of Bounty Charges", + name = "Amulet of Bounty Charges", description = "Show Amulet of bounty item charges", position = 17, section = chargesSection @@ -317,7 +317,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showBindingNecklaceCharges", - name = "Show Binding Necklace Charges", + name = "Binding Necklace Charges", description = "Show Binding necklace item charges", position = 19, section = chargesSection @@ -359,7 +359,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showExplorerRingCharges", - name = "Show Explorer's Ring Alch Charges", + name = "Explorer's Ring Alch Charges", description = "Show Explorer's ring alchemy charges", position = 21, section = chargesSection @@ -389,7 +389,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showRingOfForgingCount", - name = "Show Ring of Forging Charges", + name = "Ring of Forging Charges", description = "Show Ring of forging item charges", position = 22, section = chargesSection @@ -431,7 +431,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showInfoboxes", - name = "Show Infoboxes", + name = "Infoboxes", description = "Show an infobox with remaining charges for equipped items", position = 24 ) @@ -442,7 +442,7 @@ public interface ItemChargeConfig extends Config @ConfigItem( keyName = "showPotionDoseCount", - name = "Show Potion Doses", + name = "Potion Doses", description = "Show remaining potion doses", position = 25, section = chargesSection 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 6adb3af1f2..ce0c565c03 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 @@ -44,7 +44,7 @@ public interface OpponentInfoConfig extends Config @ConfigItem( keyName = "hitpointsDisplayStyle", - name = "Hitpoints display style", + name = "Display style", description = "Show opponent's hitpoints as a value (if known), percentage, or both", position = 1 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java index cb55db7b1e..5daffe8ef0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java @@ -55,7 +55,7 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 1, keyName = "ownNameColor", - name = "Own player color", + name = "Own player", description = "Color of your own player", section = highlightSection ) @@ -79,7 +79,7 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 3, keyName = "friendNameColor", - name = "Friend color", + name = "Friend", description = "Color of friend names", section = highlightSection ) @@ -103,7 +103,7 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 5, keyName = "clanMemberColor", - name = "Friends chat member color", + name = "Friends chat", description = "Color of friends chat members", section = highlightSection ) @@ -127,7 +127,7 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 7, keyName = "teamMemberColor", - name = "Team member color", + name = "Team member", description = "Color of team members", section = highlightSection ) @@ -151,7 +151,7 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 9, keyName = "nonClanMemberColor", - name = "Others color", + name = "Others", description = "Color of other players names", section = highlightSection ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java index d2cad67fe5..c9fc7fcd2b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java @@ -133,7 +133,7 @@ public interface PrayerConfig extends Config @ConfigItem( position = 9, keyName = "replaceOrbText", - name = "Replace orb text with prayer time left", + name = "Show time left", description = "Show time remaining of current prayers in the prayer orb." ) default boolean replaceOrbText() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java index aa145fad74..ffde9e56d4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java @@ -69,7 +69,7 @@ public interface PyramidPlunderConfig extends Config @ConfigItem( position = 3, keyName = "highlightDoorsColor", - name = "Highlight doors color", + name = "Highlight doors", description = "Selects the color for highlighting tomb doors" ) default Color highlightDoorsColor() @@ -92,7 +92,7 @@ public interface PyramidPlunderConfig extends Config @ConfigItem( position = 5, keyName = "highlightSpeartrapColor", - name = "Highlight speartrap color", + name = "Highlight speartrap", description = "Selects the color for highlighting speartraps" ) default Color highlightSpeartrapsColor() @@ -115,7 +115,7 @@ public interface PyramidPlunderConfig extends Config @ConfigItem( position = 7, keyName = "highlightContainersColor", - name = "Highlight containers color", + name = "Highlight containers", description = "Selects the color for highlighting urns, chests and sarcophagus" ) default Color highlightContainersColor() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 5a1a81bf7e..3abb6eb4f5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -47,7 +47,7 @@ public interface RaidsConfig extends Config @ConfigItem( position = 1, keyName = "pointsMessage", - name = "Display points in chatbox after raid", + name = "Display points in chatbox", description = "Display a message with total points, individual points and percentage at the end of a raid" ) default boolean pointsMessage() @@ -69,8 +69,8 @@ public interface RaidsConfig extends Config @ConfigItem( position = 3, keyName = "scoutOverlayAtBank", - name = "Show scout overlay outside lobby", - description = "Keep the overlay active while at the raids area" + name = "Show scout overlay outside", + description = "Keep the overlay active outside of the raid starting room" ) default boolean scoutOverlayAtBank() { @@ -168,8 +168,8 @@ public interface RaidsConfig extends Config @ConfigItem( position = 12, keyName = "layoutMessage", - name = "Send raid layout message when entering raid", - description = "Sends game message with raid layout on entering new raid" + name = "Raid layout message", + description = "Sends a game message with the raid layout on entering a raid" ) default boolean layoutMessage() { @@ -179,7 +179,7 @@ public interface RaidsConfig extends Config @ConfigItem( position = 13, keyName = "screenshotHotkey", - name = "Scouter screenshot hotkey", + name = "Screenshot hotkey", description = "Hotkey used to screenshot the scouting overlay" ) default Keybind screenshotHotkey() @@ -190,7 +190,7 @@ public interface RaidsConfig extends Config @ConfigItem( position = 14, keyName = "uploadScreenshot", - name = "Upload scouting screenshot", + name = "Upload screenshot", description = "Uploads the scouting screenshot to Imgur or the clipboard" ) default ImageUploadStyle uploadScreenshot() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/regenmeter/RegenMeterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/regenmeter/RegenMeterConfig.java index a206557fcb..a1a528ae58 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/regenmeter/RegenMeterConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/regenmeter/RegenMeterConfig.java @@ -52,7 +52,7 @@ public interface RegenMeterConfig extends Config @ConfigItem( keyName = "showWhenNoChange", - name = "Show hitpoints regen at full hitpoints", + name = "Show at full hitpoints", description = "Always show the hitpoints regen orb, even if there will be no stat change") default boolean showWhenNoChange() { @@ -61,7 +61,7 @@ public interface RegenMeterConfig extends Config @ConfigItem( keyName = "notifyBeforeHpRegenDuration", - name = "Hitpoint Regen Notification", + name = "Hitpoint Notification", description = "Notify approximately when your next hitpoint is about to regen. A value of 0 will disable notification." ) @Units(Units.SECONDS) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java index b6883037b7..0624edbdc6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java @@ -64,7 +64,7 @@ public interface StatusBarsConfig extends Config @ConfigItem( keyName = "leftBarMode", - name = "Left Status Bar", + name = "Left Bar", description = "Configures the left status bar" ) default BarMode leftBarMode() @@ -74,7 +74,7 @@ public interface StatusBarsConfig extends Config @ConfigItem( keyName = "rightBarMode", - name = "Right Status Bar", + name = "Right Bar", description = "Configures the right status bar" ) default BarMode rightBarMode() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java index a03f07e5f7..c1ab681930 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java @@ -36,8 +36,9 @@ public interface TileIndicatorsConfig extends Config @Alpha @ConfigItem( keyName = "highlightDestinationColor", - name = "Color of current destination highlighting", - description = "Configures the highlight color of current destination" + name = "Destination tile", + description = "Configures the highlight color of current destination", + position = 1 ) default Color highlightDestinationColor() { @@ -47,7 +48,8 @@ public interface TileIndicatorsConfig extends Config @ConfigItem( keyName = "highlightDestinationTile", name = "Highlight destination tile", - description = "Highlights tile player is walking to" + description = "Highlights tile player is walking to", + position = 2 ) default boolean highlightDestinationTile() { @@ -57,8 +59,9 @@ public interface TileIndicatorsConfig extends Config @Alpha @ConfigItem( keyName = "highlightHoveredColor", - name = "Color of current hovered highlighting", - description = "Configures the highlight color of hovered tile" + name = "Hovered tile", + description = "Configures the highlight color of hovered tile", + position = 3 ) default Color highlightHoveredColor() { @@ -68,7 +71,8 @@ public interface TileIndicatorsConfig extends Config @ConfigItem( keyName = "highlightHoveredTile", name = "Highlight hovered tile", - description = "Highlights tile player is hovering with mouse" + description = "Highlights tile player is hovering with mouse", + position = 4 ) default boolean highlightHoveredTile() { @@ -78,8 +82,9 @@ public interface TileIndicatorsConfig extends Config @Alpha @ConfigItem( keyName = "highlightCurrentColor", - name = "Color of current true tile highlighting", - description = "Configures the highlight color of current true tile" + name = "True tile", + description = "Configures the highlight color of current true tile", + position = 5 ) default Color highlightCurrentColor() { @@ -88,8 +93,9 @@ public interface TileIndicatorsConfig extends Config @ConfigItem( keyName = "highlightCurrentTile", - name = "Highlight current true tile", - description = "Highlights true tile player is on as seen by server" + name = "Highlight true tile", + description = "Highlights true tile player is on as seen by server", + position = 6 ) default boolean highlightCurrentTile() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java index 76ceb67bc6..73590d7d2d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java @@ -110,7 +110,7 @@ public interface TimeTrackingConfig extends Config @ConfigItem( keyName = "timerWarningThreshold", - name = "Timer Warning Threshold", + name = "Warning Threshold", description = "The time at which to change the timer color to the warning color", position = 6 ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java index 407d9018aa..a466568b82 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java @@ -51,7 +51,7 @@ public interface WintertodtConfig extends Config @ConfigItem( position = 1, keyName = "damageNotificationColor", - name = "Damage Notification Color", + name = "Damage Notification", description = "Color of damage notification text in chat" ) default Color damageNotificationColor() @@ -62,7 +62,7 @@ public interface WintertodtConfig extends Config @ConfigItem( position = 2, keyName = "roundNotification", - name = "Wintertodt round notification", + name = "Round notification", description = "Notifies you before the round starts (in seconds)" ) @Range( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java index 8dddb1ad60..3fbca342b6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java @@ -34,7 +34,7 @@ public interface WorldMapConfig extends Config { @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_FAIRY_RING_TOOLTIPS, - name = "Show fairy ring codes in tooltip", + name = "Fairy ring code tooltip", description = "Display the code for fairy rings in the icon tooltip", position = 1 ) @@ -45,7 +45,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_FAIRY_RING_ICON, - name = "Show fairy ring travel icon", + name = "Fairy ring travel icon", description = "Override the travel icon for fairy rings", position = 2 ) @@ -56,7 +56,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_SHORTCUT_TOOLTIPS, - name = "Show agility level requirement", + name = "Agility level requirement", description = "Display the required Agility level in the icon tooltip", position = 3 ) @@ -78,7 +78,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_COURSE_TOOLTIPS, - name = "Show agility course in tooltip", + name = "Agility course tooltip", description = "Displays the name of the agility course in the tooltip", position = 5 ) @@ -100,7 +100,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_NORMAL_TELEPORT_ICON, - name = "Show Standard Spellbook destinations", + name = "Standard Spellbook destinations", description = "Show icons at the destinations for teleports in the Standard Spellbook", position = 7 ) @@ -111,7 +111,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_MINIGAME_TOOLTIP, - name = "Show minigame name in tooltip", + name = "Minigame names", description = "Display the name of the minigame in the icon tooltip", position = 8 ) @@ -122,7 +122,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_ANCIENT_TELEPORT_ICON, - name = "Show Ancient Magicks destinations", + name = "Ancient Magicks destinations", description = "Show icons at the destinations for teleports in the Ancient Spellbook", position = 9 ) @@ -133,7 +133,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_LUNAR_TELEPORT_ICON, - name = "Show Lunar Spellbook destinations", + name = "Lunar Spellbook destinations", description = "Show icons at the destinations for teleports in the Lunar Spellbook", position = 10 ) @@ -144,7 +144,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_ARCEUUS_TELEPORT_ICON, - name = "Show Arceuus Spellbook destinations", + name = "Arceuus Spellbook destinations", description = "Show icons at the destinations for teleports in the Arceuus Spellbook", position = 11 ) @@ -155,7 +155,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_JEWELLERY_TELEPORT_ICON, - name = "Show jewellery teleport locations", + name = "Jewellery teleport destinations", description = "Show icons at the destinations for teleports from jewellery", position = 12 ) @@ -166,7 +166,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_SCROLL_TELEPORT_ICON, - name = "Show teleport scroll locations", + name = "Teleport scroll destinations", description = "Show icons at the destinations for teleports from scrolls", position = 13 ) @@ -177,7 +177,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_MISC_TELEPORT_ICON, - name = "Show misc teleport locations", + name = "Misc teleport destinations", description = "Show icons at the destinations for miscellaneous teleport items", position = 14 ) @@ -188,7 +188,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS, - name = "Show quest names and status", + name = "Quest names and status", description = "Indicates the names of quests and shows completion status", position = 15 ) @@ -199,7 +199,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_FARMING_PATCH_TOOLTIPS, - name = "Show farming patch type", + name = "Farming patch type", description = "Display the type of farming patches in the icon tooltip", position = 16 ) @@ -210,7 +210,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_TOOLTIPS, - name = "Show rare tree type", + name = "Rare tree type", description = "Display the type of rare tree in the icon tooltip", position = 17 ) @@ -232,7 +232,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_TRANSPORTATION_TELEPORT_TOOLTIPS, - name = "Show transportation tooltips", + name = "Transportation tooltips", description = "Indicates types and destinations of Transportation", position = 19 ) @@ -243,7 +243,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_RUNECRAFTING_ALTAR_ICON, - name = "Show runecrafting altar locations", + name = "Runecrafting altar locations", description = "Show the icons of runecrafting altars", position = 20 ) @@ -254,7 +254,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_MINING_SITE_TOOLTIPS, - name = "Show mining site tooltips", + name = "Mining site tooltips", description = "Indicates the ore available at mining sites", position = 21 ) @@ -265,7 +265,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_DUNGEON_TOOLTIPS, - name = "Show dungeon tooltips", + name = "Dungeon tooltips", description = "Indicates the names of dungeons", position = 22 ) @@ -276,7 +276,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_HUNTER_AREA_TOOLTIPS, - name = "Show hunter area tooltips", + name = "Hunter area tooltips", description = "Indicates the creatures inside a hunting area", position = 23 ) @@ -287,7 +287,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_FISHING_SPOT_TOOLTIPS, - name = "Show fishing spot tooltips", + name = "Fishing spot tooltips", description = "Indicates the type of fish fishable at the fishing spot", position = 24 ) @@ -298,7 +298,7 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_KOUREND_TASK_TOOLTIPS, - name = "Show Kourend task tooltips", + name = "Kourend task tooltips", description = "Indicates the task or unlock for Kourend Favour locations", position = 25 ) From 524ebee67d85b4aa153667acfaa6df28c2934728 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 13 Jan 2021 21:16:39 -0500 Subject: [PATCH 171/173] config panel: fix combobox displayed size The size was being computed from the enum names during the getPreferredSize() call due to not having the renderer set yet. Additionally the old prototype display value was not being used during this as it was not set yet, either. --- .../client/plugins/config/ConfigPanel.java | 14 +++++++++----- .../client/ui/components/ComboBoxListRenderer.java | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index fe6a5b54a2..b72286e3b1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -487,15 +487,19 @@ class ConfigPanel extends PluginPanel if (cid.getType().isEnum()) { Class type = (Class) cid.getType(); - JComboBox box = new JComboBox(type.getEnumConstants()); + + JComboBox> box = new JComboBox>(type.getEnumConstants()); // NOPMD: UseDiamondOperator + // set renderer prior to calling box.getPreferredSize(), since it will invoke the renderer + // to build components for each combobox element in order to compute the display size of the + // combobox + box.setRenderer(new ComboBoxListRenderer<>()); box.setPreferredSize(new Dimension(box.getPreferredSize().width, 25)); - box.setRenderer(new ComboBoxListRenderer()); box.setForeground(Color.WHITE); box.setFocusable(false); - box.setPrototypeDisplayValue("XXXXXXXX"); //sorry but this is the way to keep the size of the combobox in check. + try { - Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName())); + Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName())); box.setSelectedItem(selectedItem); box.setToolTipText(Text.titleCase(selectedItem)); } @@ -508,7 +512,7 @@ class ConfigPanel extends PluginPanel if (e.getStateChange() == ItemEvent.SELECTED) { changeConfiguration(box, cd, cid); - box.setToolTipText(Text.titleCase((Enum) box.getSelectedItem())); + box.setToolTipText(Text.titleCase((Enum) box.getSelectedItem())); } }); item.add(box, BorderLayout.EAST); diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/ComboBoxListRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/components/ComboBoxListRenderer.java index 5aeb710115..b73700134c 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/ComboBoxListRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/ComboBoxListRenderer.java @@ -39,11 +39,11 @@ import net.runelite.client.util.Text; * was very hard to see in the dark gray background, this makes the selected * item white and adds some padding to the elements for more readable list. */ -public final class ComboBoxListRenderer extends JLabel implements ListCellRenderer +public final class ComboBoxListRenderer extends JLabel implements ListCellRenderer { @Override - public Component getListCellRendererComponent(JList list, Object o, int index, boolean isSelected, boolean cellHasFocus) + public Component getListCellRendererComponent(JList list, T o, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { From 7dae40daef1b71973cb8fab489ffb9bfb21e9db1 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 13 Jan 2021 21:45:57 -0500 Subject: [PATCH 172/173] custom cursor: use cursor name for combobox labels --- .../runelite/client/plugins/customcursor/CustomCursor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java index 3baf137c96..1625ba8587 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java @@ -56,4 +56,10 @@ public enum CustomCursor this.name = name; this.cursorImage = ImageUtil.loadImageResource(CustomCursorPlugin.class, icon); } + + @Override + public String toString() + { + return name; + } } From 45e14bb756500e22a039e96b05080178051cfca0 Mon Sep 17 00:00:00 2001 From: TheRealNull Date: Thu, 14 Jan 2021 14:58:08 -0500 Subject: [PATCH 173/173] ci: remove upstreams template (sneaky) --- .github/workflows/CI.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index a117224e5f..0000000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: CI - -on: [ push, pull_request ] - -jobs: - build: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Cache - uses: actions/cache@v2 - with: - path: | - ~/.m2/repository - ~/.cache/runelite - key: ${{ runner.os }}-cache-${{ hashFiles('**/pom.xml', '**/build.sh') }} - restore-keys: | - ${{ runner.os }}-cache- - - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Build - run: ./ci/build.sh