From 7dcfafab417aff9aa5c5d808ccdecfad978d8900 Mon Sep 17 00:00:00 2001 From: SirWrain <83126316+SirWrain@users.noreply.github.com> Date: Sat, 18 Jun 2022 00:09:52 -0400 Subject: [PATCH 01/13] achievement diary: Fix Kourend elite blood runecrafting task text (#15128) --- .../achievementdiary/diaries/KourendDiaryRequirement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java index 106f64cc75..8446bbb5d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java @@ -107,7 +107,7 @@ public class KourendDiaryRequirement extends GenericDiaryRequirement new QuestRequirement(Quest.DREAM_MENTOR)); //ELITE - add("Craft one or more Blood runes from Essence.", + add("Craft one or more Blood runes from Dark essence fragments.", new SkillRequirement(Skill.RUNECRAFT, 77), new SkillRequirement(Skill.MINING, 38), new SkillRequirement(Skill.CRAFTING, 38), From 2e3d6e27feffbd2aab8955d0f01e6369b7765f12 Mon Sep 17 00:00:00 2001 From: Robin <5983417+rorro@users.noreply.github.com> Date: Sun, 19 Jun 2022 07:15:15 +0200 Subject: [PATCH 02/13] game: Add lizards to isDying block list (#15144) --- .../src/main/java/net/runelite/client/game/NpcUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java index cb7fd3cdda..1e0482d44f 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java @@ -72,6 +72,9 @@ public class NpcUtil case NpcID.DESERT_LIZARD: case NpcID.DESERT_LIZARD_460: case NpcID.DESERT_LIZARD_461: + case NpcID.LIZARD: + case NpcID.SMALL_LIZARD: + case NpcID.SMALL_LIZARD_463: case NpcID.GROWTHLING: case NpcID.KALPHITE_QUEEN_963: case NpcID.KALPHITE_QUEEN_965: From cc61a0095032dfbec2187fa78161dca6740dc8bf Mon Sep 17 00:00:00 2001 From: Hexagon Date: Sun, 19 Jun 2022 09:00:22 -0300 Subject: [PATCH 03/13] spec-counter: use npc index instead of id for tracking --- .../client/plugins/specialcounter/Boss.java | 71 ------------------- .../specialcounter/SpecialCounterPlugin.java | 41 ++++------- .../specialcounter/SpecialCounterUpdate.java | 2 +- .../SpecialCounterPluginTest.java | 5 +- 4 files changed, 19 insertions(+), 100 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java deleted file mode 100644 index e0ba59d3d6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, Raqes - * 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 com.google.common.collect.Sets; -import java.util.Set; -import lombok.Getter; -import lombok.ToString; -import net.runelite.api.NpcID; - -@Getter -@ToString -enum Boss -{ - ABYSSAL_SIRE(NpcID.ABYSSAL_SIRE, NpcID.ABYSSAL_SIRE_5887, NpcID.ABYSSAL_SIRE_5888, NpcID.ABYSSAL_SIRE_5889, NpcID.ABYSSAL_SIRE_5890, NpcID.ABYSSAL_SIRE_5891, NpcID.ABYSSAL_SIRE_5908), - CALLISTO(NpcID.CALLISTO, NpcID.CALLISTO_6609), - CERBERUS(NpcID.CERBERUS, NpcID.CERBERUS_5863, NpcID.CERBERUS_5866), - CHAOS_ELEMENTAL(NpcID.CHAOS_ELEMENTAL, NpcID.CHAOS_ELEMENTAL_6505), - CORPOREAL_BEAST(NpcID.CORPOREAL_BEAST), - GENERAL_GRAARDOR(NpcID.GENERAL_GRAARDOR, NpcID.GENERAL_GRAARDOR_6494), - GIANT_MOLE(NpcID.GIANT_MOLE, NpcID.GIANT_MOLE_6499), - KALPHITE_QUEEN(NpcID.KALPHITE_QUEEN, NpcID.KALPHITE_QUEEN_963, NpcID.KALPHITE_QUEEN_965, NpcID.KALPHITE_QUEEN_4303, NpcID.KALPHITE_QUEEN_4304, NpcID.KALPHITE_QUEEN_6500, NpcID.KALPHITE_QUEEN_6501), - KING_BLACK_DRAGON(NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), - KRIL_TSUROTH(NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), - VENETENATIS(NpcID.VENENATIS, NpcID.VENENATIS_6610), - VETION(NpcID.VETION, NpcID.VETION_REBORN), - ALCHEMICAL_HYDRA(NpcID.ALCHEMICAL_HYDRA, NpcID.ALCHEMICAL_HYDRA_8616, NpcID.ALCHEMICAL_HYDRA_8617, NpcID.ALCHEMICAL_HYDRA_8618, NpcID.ALCHEMICAL_HYDRA_8619, NpcID.ALCHEMICAL_HYDRA_8620, NpcID.ALCHEMICAL_HYDRA_8621, NpcID.ALCHEMICAL_HYDRA_8622, NpcID.ALCHEMICAL_HYDRA_8634); - - private final Set ids; - - Boss(Integer... ids) - { - this.ids = Sets.newHashSet(ids); - } - - static Boss getBoss(int id) - { - for (Boss boss : values()) - { - if (boss.ids.contains(id)) - { - return boss; - } - } - - return null; - } - -} \ No newline at end of file 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 7183d2c0d5..f308fd1525 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 @@ -101,7 +101,7 @@ public class SpecialCounterPlugin extends Plugin private boolean wasInInstance; private SpecialWeapon specialWeapon; - private final Set interactedNpcIds = new HashSet<>(); + private final Set interactedNpcIndexes = new HashSet<>(); private final SpecialCounter[] specialCounter = new SpecialCounter[SpecialWeapon.values().length]; @Getter(AccessLevel.PACKAGE) @@ -156,7 +156,7 @@ public class SpecialCounterPlugin extends Plugin specialPercentage = -1; lastSpecTarget = null; lastSpecTick = -1; - interactedNpcIds.clear(); + interactedNpcIndexes.clear(); } @Override @@ -275,6 +275,7 @@ public class SpecialCounterPlugin extends Plugin NPC npc = (NPC) target; int interactingId = npc.getId(); + int npcIndex = npc.getIndex(); if (IGNORED_NPCS.contains(interactingId)) { @@ -282,10 +283,10 @@ public class SpecialCounterPlugin extends Plugin } // If this is a new NPC reset the counters - if (!interactedNpcIds.contains(interactingId)) + if (!interactedNpcIndexes.contains(npcIndex)) { removeCounters(); - addInteracting(interactingId); + interactedNpcIndexes.add(npcIndex); } if (wasSpec && specialWeapon != null && hitsplat.getAmount() > 0) @@ -300,7 +301,7 @@ public class SpecialCounterPlugin extends Plugin if (!party.getMembers().isEmpty()) { - final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(interactingId, specialWeapon, hit, client.getWorld(), localPlayerId); + final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(npcIndex, specialWeapon, hit, client.getWorld(), localPlayerId); specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); party.send(specialCounterUpdate); } @@ -309,18 +310,6 @@ public class SpecialCounterPlugin extends Plugin } } - private void addInteracting(int npcId) - { - interactedNpcIds.add(npcId); - - // Add alternate forms of bosses - final Boss boss = Boss.getBoss(npcId); - if (boss != null) - { - interactedNpcIds.addAll(boss.getIds()); - } - } - @Subscribe public void onNpcDespawned(NpcDespawned npcDespawned) { @@ -331,7 +320,7 @@ public class SpecialCounterPlugin extends Plugin lastSpecTarget = null; } - if (actor.isDead() && interactedNpcIds.contains(actor.getId())) + if (actor.isDead() && interactedNpcIndexes.contains(actor.getIndex())) { removeCounters(); } @@ -340,7 +329,8 @@ public class SpecialCounterPlugin extends Plugin @Subscribe public void onSpecialCounterUpdate(SpecialCounterUpdate event) { - if (party.getLocalMember().getMemberId().equals(event.getMemberId())) + if (party.getLocalMember().getMemberId().equals(event.getMemberId()) + || event.getWorld() != client.getWorld()) { return; } @@ -354,13 +344,13 @@ public class SpecialCounterPlugin extends Plugin clientThread.invoke(() -> { // If not interacting with any npcs currently, add to interacting list - if (interactedNpcIds.isEmpty()) + if (interactedNpcIndexes.isEmpty()) { - addInteracting(event.getNpcId()); + interactedNpcIndexes.add(event.getNpcIndex()); } // Otherwise we only add the count if it is against a npc we are already tracking - if (interactedNpcIds.contains(event.getNpcId())) + if (interactedNpcIndexes.contains(event.getNpcIndex())) { if (config.infobox()) { @@ -368,10 +358,7 @@ public class SpecialCounterPlugin extends Plugin } } - if (event.getWorld() == client.getWorld()) - { - playerInfoDrops.add(createSpecInfoDrop(event.getWeapon(), event.getHit(), event.getPlayerId())); - } + playerInfoDrops.add(createSpecInfoDrop(event.getWeapon(), event.getHit(), event.getPlayerId())); }); } @@ -453,7 +440,7 @@ public class SpecialCounterPlugin extends Plugin private void removeCounters() { - interactedNpcIds.clear(); + interactedNpcIndexes.clear(); for (int i = 0; i < specialCounter.length; ++i) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java index d9416ecdf7..09e99f6356 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java @@ -32,7 +32,7 @@ import net.runelite.client.party.messages.PartyMemberMessage; @EqualsAndHashCode(callSuper = true) public class SpecialCounterUpdate extends PartyMemberMessage { - private final int npcId; + private final int npcIndex; private final SpecialWeapon weapon; private final int hit; private final int world; 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 55bfdc6237..25a1c1e1db 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 @@ -238,7 +238,10 @@ public class SpecialCounterPluginTest { NPC targetA = mock(NPC.class); NPC targetB = mock(NPC.class); - when(targetB.getId()).thenReturn(1); // a different npc type + + // a different npc type + when(targetB.getId()).thenReturn(1); + when(targetB.getIndex()).thenReturn(1); Player player = mock(Player.class); when(client.getLocalPlayer()).thenReturn(player); From d87dec02be8a223af0722d09200980e5c1ee1222 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 19 Jun 2022 08:20:43 -0400 Subject: [PATCH 04/13] party: make ping hotkey configurable This is conflicting with shift-click swaps currently --- .../client/plugins/party/PartyConfig.java | 16 +++++++- .../client/plugins/party/PartyPlugin.java | 37 ++++++++++++++++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java index fd8553ad5a..aed562340d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java @@ -28,6 +28,7 @@ package net.runelite.client.plugins.party; 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(PartyConfig.GROUP) public interface PartyConfig extends Config @@ -37,7 +38,7 @@ public interface PartyConfig extends Config @ConfigItem( keyName = "pings", name = "Pings", - description = "Enables party pings (shift + left-click)", + description = "Enables party pings", position = 1 ) default boolean pings() @@ -60,13 +61,24 @@ public interface PartyConfig extends Config keyName = "recolorNames", name = "Recolor names", description = "Recolor party members names based on unique color hash", - position = 4 + position = 3 ) default boolean recolorNames() { return true; } + @ConfigItem( + keyName = "pingHotkey", + name = "Ping hotkey", + description = "Key to hold to send a tile ping", + position = 4 + ) + default Keybind pingHotkey() + { + return Keybind.NOT_SET; + } + @ConfigItem( keyName = "previousPartyId", name = "", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java index 068f3e0efc..4f9f438d6c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java @@ -45,7 +45,6 @@ import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; -import net.runelite.api.KeyCode; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; import net.runelite.api.Player; @@ -54,6 +53,7 @@ import net.runelite.api.SoundEffectID; import net.runelite.api.Tile; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.CommandExecuted; +import net.runelite.api.events.FocusChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.MenuOptionClicked; @@ -66,6 +66,7 @@ import net.runelite.client.events.ConfigChanged; import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.events.PartyChanged; import net.runelite.client.events.PartyMemberAvatar; +import net.runelite.client.input.KeyManager; import net.runelite.client.party.PartyMember; import net.runelite.client.party.PartyService; import net.runelite.client.party.WSClient; @@ -87,6 +88,7 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; import net.runelite.client.util.ColorUtil; +import net.runelite.client.util.HotkeyListener; import net.runelite.client.util.ImageUtil; import net.runelite.client.util.Text; @@ -128,6 +130,9 @@ public class PartyPlugin extends Plugin @Inject private ClientToolbar clientToolbar; + @Inject + private KeyManager keyManager; + @Inject @Named("developerMode") boolean developerMode; @@ -145,6 +150,23 @@ public class PartyPlugin extends Plugin private String lastCharacterName = ""; private WorldPoint lastLocation; + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.pingHotkey()) + { + @Override + public void hotkeyPressed() + { + hotkeyPressed = true; + } + + @Override + public void hotkeyReleased() + { + hotkeyPressed = false; + } + }; + + private boolean hotkeyPressed = false; + @Override public void configure(Binder binder) { @@ -168,6 +190,7 @@ public class PartyPlugin extends Plugin clientToolbar.addNavigation(navButton); overlayManager.add(partyPingOverlay); + keyManager.registerKeyListener(hotkeyListener); wsClient.registerMessage(SkillUpdate.class); wsClient.registerMessage(TilePing.class); wsClient.registerMessage(LocationUpdate.class); @@ -187,6 +210,7 @@ public class PartyPlugin extends Plugin pendingTilePings.clear(); worldMapManager.removeIf(PartyWorldMapPoint.class::isInstance); overlayManager.remove(partyPingOverlay); + keyManager.unregisterKeyListener(hotkeyListener); wsClient.unregisterMessage(SkillUpdate.class); wsClient.unregisterMessage(TilePing.class); wsClient.unregisterMessage(LocationUpdate.class); @@ -200,6 +224,15 @@ public class PartyPlugin extends Plugin return configManager.getConfig(PartyConfig.class); } + @Subscribe + public void onFocusChanged(FocusChanged focusChanged) + { + if (!focusChanged.isFocused()) + { + hotkeyPressed = false; + } + } + @Subscribe public void onOverlayMenuClicked(OverlayMenuClicked event) { @@ -229,7 +262,7 @@ public class PartyPlugin extends Plugin @Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { - if (!client.isKeyPressed(KeyCode.KC_SHIFT) || client.isMenuOpen() || party.getMembers().isEmpty() || !config.pings()) + if (!hotkeyPressed || client.isMenuOpen() || party.getMembers().isEmpty() || !config.pings()) { return; } From 6b68ba98069d72ccef8172e763ceb3c4a344d12a Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Sat, 18 Jun 2022 22:35:34 -0700 Subject: [PATCH 05/13] game: Remove isDying block on transforming NPCs These have been fixed in an internal change. --- .../src/main/java/net/runelite/client/game/NpcUtil.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java index 1e0482d44f..b3d6aa54a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java @@ -76,10 +76,7 @@ public class NpcUtil case NpcID.SMALL_LIZARD: case NpcID.SMALL_LIZARD_463: case NpcID.GROWTHLING: - case NpcID.KALPHITE_QUEEN_963: - case NpcID.KALPHITE_QUEEN_965: - case NpcID.VETION: - case NpcID.VETION_REBORN: + case NpcID.KALPHITE_QUEEN_963: // KQ's first form sometimes regenerates 1hp after reaching 0hp, thus not dying return false; default: return npc.isDead(); From 6aadd3ba26bcdf25844ebd9cbd62db8596039e64 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 18 Jun 2022 22:28:41 -0400 Subject: [PATCH 06/13] Add rtconfig for excluded dead npcs --- .../net/runelite/client/RuntimeConfig.java | 3 +++ .../net/runelite/client/game/NpcUtil.java | 19 ++++++++++++++++++- .../entityhider/EntityHiderPlugin.java | 5 ++++- .../MenuEntrySwapperPlugin.java | 5 ++++- .../client/plugins/PluginManagerTest.java | 3 ++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/RuntimeConfig.java b/runelite-client/src/main/java/net/runelite/client/RuntimeConfig.java index fc7fdb4492..fe5f0e733d 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuntimeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/RuntimeConfig.java @@ -27,6 +27,7 @@ package net.runelite.client; import com.google.common.base.Strings; import java.util.Collections; import java.util.Map; +import java.util.Set; import javax.swing.SwingUtilities; import lombok.Data; import net.runelite.client.ui.FatalErrorDialog; @@ -41,6 +42,8 @@ public class RuntimeConfig private String outageMessage; private Map outageLinks; + private Set ignoreDeadNpcs; + public boolean showOutageMessage() { if (Strings.isNullOrEmpty(getOutageMessage())) diff --git a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java index b3d6aa54a2..a34c0abf1c 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java @@ -25,11 +25,22 @@ */ package net.runelite.client.game; +import java.util.Set; +import javax.inject.Inject; import net.runelite.api.NPC; import net.runelite.api.NpcID; +import net.runelite.client.RuntimeConfig; public class NpcUtil { + private final RuntimeConfig runtimeConfig; + + @Inject + private NpcUtil(RuntimeConfig runtimeConfig) + { + this.runtimeConfig = runtimeConfig; + } + /** * Returns whether an NPC is dying and can no longer be interacted with, or if it is still alive or in some special * state where it can be 0hp without dying. (For example, Gargoyles and other slayer monsters with item weaknesses @@ -38,7 +49,7 @@ public class NpcUtil * @param npc NPC to check whether it is dying * @return {@code true} if the NPC is dying */ - public static boolean isDying(final NPC npc) + public boolean isDying(final NPC npc) { final int id = npc.getId(); switch (id) @@ -79,6 +90,12 @@ public class NpcUtil case NpcID.KALPHITE_QUEEN_963: // KQ's first form sometimes regenerates 1hp after reaching 0hp, thus not dying return false; default: + Set ignoredNpcs = runtimeConfig.getIgnoreDeadNpcs(); + if (ignoredNpcs != null && ignoredNpcs.contains(id)) + { + return false; + } + return npc.isDead(); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java index a3932376e3..50232a82a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java @@ -59,6 +59,9 @@ public class EntityHiderPlugin extends Plugin @Inject private Hooks hooks; + @Inject + private NpcUtil npcUtil; + private boolean hideOthers; private boolean hideOthers2D; private boolean hideFriends; @@ -191,7 +194,7 @@ public class EntityHiderPlugin extends Plugin } // dead npcs can also be interacting so prioritize it over the interacting check - if (NpcUtil.isDying(npc) && hideDeadNpcs) + if (npcUtil.isDying(npc) && hideDeadNpcs) { 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 3c11c50207..b7b3488d1c 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 @@ -191,6 +191,9 @@ public class MenuEntrySwapperPlugin extends Plugin @Inject private ChatMessageManager chatMessageManager; + @Inject + private NpcUtil npcUtil; + private boolean configuringShiftClick = false; private boolean configuringLeftClick = false; @@ -1275,7 +1278,7 @@ public class MenuEntrySwapperPlugin extends Plugin .filter(e -> { final NPC npc = e.getNpc(); - return npc == null || !NpcUtil.isDying(npc); + return npc == null || !npcUtil.isDying(npc); }) .toArray(MenuEntry[]::new); if (oldEntries.length != newEntries.length) diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java index 3166552b6a..4cce2034fc 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/PluginManagerTest.java @@ -48,6 +48,7 @@ import java.util.Set; import net.runelite.api.Client; import net.runelite.client.RuneLite; import net.runelite.client.RuneLiteModule; +import net.runelite.client.RuntimeConfig; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigItem; import net.runelite.client.eventbus.EventBus; @@ -93,7 +94,7 @@ public class PluginManagerTest .thenThrow(new RuntimeException("in plugin manager test")); Injector injector = Guice.createInjector(Modules - .override(new RuneLiteModule(okHttpClient, () -> null, () -> null, true, false, + .override(new RuneLiteModule(okHttpClient, () -> null, () -> mock(RuntimeConfig.class), true, false, RuneLite.DEFAULT_SESSION_FILE, RuneLite.DEFAULT_CONFIG_FILE)) .with(BoundFieldModule.of(this))); From b96867bb06e6f29b0327c2d7a634484ba12f1293 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 18 Jun 2022 22:28:51 -0400 Subject: [PATCH 07/13] Require Attack option for dying npcs --- .../src/main/java/net/runelite/client/game/NpcUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java index a34c0abf1c..ee4f580512 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NpcUtil.java @@ -28,8 +28,10 @@ package net.runelite.client.game; import java.util.Set; import javax.inject.Inject; import net.runelite.api.NPC; +import net.runelite.api.NPCComposition; import net.runelite.api.NpcID; import net.runelite.client.RuntimeConfig; +import org.apache.commons.lang3.ArrayUtils; public class NpcUtil { @@ -96,7 +98,9 @@ public class NpcUtil return false; } - return npc.isDead(); + final NPCComposition npcComposition = npc.getTransformedComposition(); + boolean hasAttack = npcComposition != null && ArrayUtils.contains(npcComposition.getActions(), "Attack"); + return hasAttack && npc.isDead(); } } } From fcd869fa10ea6d873075e67284ea1b04643fc04c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 19 Jun 2022 16:50:26 +0200 Subject: [PATCH 08/13] account: send username and sessionid when redirecting to /logged-in page This also logs in user on website Signed-off-by: Tomas Slusny --- .../java/net/runelite/client/account/SessionManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java index 04d264ef5b..c547325c6c 100644 --- a/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java +++ b/runelite-client/src/main/java/net/runelite/client/account/SessionManager.java @@ -246,7 +246,12 @@ public class SessionManager // Save session to disk saveSession(); - req.getResponseHeaders().set("Location", oauthRedirect); + final HttpUrl redirect = HttpUrl.get(oauthRedirect).newBuilder() + .addQueryParameter("username", username) + .addQueryParameter("sessionId", sessionId.toString()) + .build(); + + req.getResponseHeaders().set("Location", redirect.toString()); req.sendResponseHeaders(302, 0); } catch (Exception e) From 1d616c905054e6c8193fd3d0d7155ac8d3b22e45 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 19 Jun 2022 00:10:22 -0400 Subject: [PATCH 09/13] boosts: cleanup --- .../client/plugins/boosts/BoostIndicator.java | 4 ++-- .../client/plugins/boosts/BoostsOverlay.java | 13 ++----------- .../client/plugins/boosts/StatChangeIndicator.java | 4 ++-- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java index 001e8ae5c8..ff286f409f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java @@ -32,7 +32,7 @@ import net.runelite.api.Skill; import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; -public class BoostIndicator extends InfoBox +class BoostIndicator extends InfoBox { private final BoostsPlugin plugin; private final BoostsConfig config; @@ -87,7 +87,7 @@ public class BoostIndicator extends InfoBox @Override public boolean render() { - return config.displayInfoboxes() && plugin.canShowBoosts() && plugin.getSkillsToDisplay().contains(getSkill()); + return plugin.canShowBoosts() && plugin.getSkillsToDisplay().contains(getSkill()) && config.displayInfoboxes(); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java index fd53503444..fff6408f2f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java @@ -61,13 +61,13 @@ class BoostsOverlay extends OverlayPanel @Override public Dimension render(Graphics2D graphics) { - if (config.displayInfoboxes()) + final Set boostedSkills = plugin.getSkillsToDisplay(); + if (boostedSkills.isEmpty() || !config.displayPanel()) { return null; } int nextChange = plugin.getChangeDownTicks(); - if (nextChange != -1) { panelComponent.getChildren().add(LineComponent.builder() @@ -77,7 +77,6 @@ class BoostsOverlay extends OverlayPanel } nextChange = plugin.getChangeUpTicks(); - if (nextChange != -1) { panelComponent.getChildren().add(LineComponent.builder() @@ -86,13 +85,6 @@ class BoostsOverlay extends OverlayPanel .build()); } - final Set boostedSkills = plugin.getSkillsToDisplay(); - - if (boostedSkills.isEmpty()) - { - return super.render(graphics); - } - if (plugin.canShowBoosts()) { for (Skill skill : boostedSkills) @@ -136,6 +128,5 @@ class BoostsOverlay extends OverlayPanel } return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java index 5c9ef73762..f93bae6086 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java @@ -29,7 +29,7 @@ import java.awt.image.BufferedImage; import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; -public class StatChangeIndicator extends InfoBox +class StatChangeIndicator extends InfoBox { private final boolean up; private final BoostsPlugin plugin; @@ -61,6 +61,6 @@ public class StatChangeIndicator extends InfoBox public boolean render() { final int time = up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks(); - return config.displayInfoboxes() && time != -1; + return time != -1 && config.displayInfoboxes(); } } From e8a65220e0e8a8689ab1c30ba6a198ad6edeb401 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 19 Jun 2022 00:10:32 -0400 Subject: [PATCH 10/13] boosts: add compact view --- .../client/plugins/boosts/BoostsConfig.java | 36 ++++- .../client/plugins/boosts/BoostsOverlay.java | 4 - .../client/plugins/boosts/BoostsPlugin.java | 30 +++- .../plugins/boosts/CompactBoostsOverlay.java | 152 ++++++++++++++++++ 4 files changed, 208 insertions(+), 14 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java 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 0711d17fb3..86b9629081 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 @@ -59,7 +59,7 @@ public interface BoostsConfig extends Config @ConfigItem( keyName = "relativeBoost", - name = "Use Relative Boosts", + name = "Show relative boosts", description = "Configures whether or not relative boost is used", position = 2 ) @@ -70,8 +70,8 @@ public interface BoostsConfig extends Config @ConfigItem( keyName = "displayIndicators", - name = "Display as infoboxes", - description = "Configures whether or not to display the boost as infoboxes", + name = "Display infoboxes", + description = "Configures whether to display boost infoboxes", position = 3 ) default boolean displayInfoboxes() @@ -79,11 +79,33 @@ public interface BoostsConfig extends Config return true; } + @ConfigItem( + keyName = "displayPanel", + name = "Display panel", + description = "Configures whether to display the boost panel", + position = 3 + ) + default boolean displayPanel() + { + return false; + } + + @ConfigItem( + keyName = "compactDisplay", + name = "Compact display", + description = "Displays skill boosts in a more compact panel", + position = 4 + ) + default boolean compactDisplay() + { + return false; + } + @ConfigItem( keyName = "displayNextBuffChange", name = "Next buff change", description = "Configures whether or not to display when the next buffed stat change will be", - position = 4 + position = 10 ) default DisplayChangeMode displayNextBuffChange() { @@ -94,7 +116,7 @@ public interface BoostsConfig extends Config keyName = "displayNextDebuffChange", name = "Next debuff change", description = "Configures whether or not to display when the next debuffed stat change will be", - position = 5 + position = 11 ) default DisplayChangeMode displayNextDebuffChange() { @@ -105,7 +127,7 @@ public interface BoostsConfig extends Config keyName = "boostThreshold", 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 + position = 12 ) default int boostThreshold() { @@ -116,7 +138,7 @@ public interface BoostsConfig extends Config keyName = "notifyOnBoost", name = "Notify on boost threshold", description = "Configures whether or not a notification will be sent for boosted stats.", - position = 7 + position = 13 ) default boolean notifyOnBoost() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java index fff6408f2f..16d454acf0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java @@ -30,10 +30,7 @@ import java.awt.Graphics2D; import java.util.Set; import javax.inject.Inject; import net.runelite.api.Client; -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.Skill; -import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; -import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPanel; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; @@ -55,7 +52,6 @@ class BoostsOverlay extends OverlayPanel this.config = config; setPosition(OverlayPosition.TOP_LEFT); setPriority(OverlayPriority.MED); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay")); } @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 dac873dbf7..02f23a8776 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 @@ -26,27 +26,32 @@ package net.runelite.client.plugins.boosts; import com.google.common.collect.ImmutableSet; import com.google.inject.Provides; +import java.awt.image.BufferedImage; import java.util.Arrays; import java.util.EnumSet; import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; +import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.Client; import net.runelite.api.Constants; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.Prayer; import net.runelite.api.Skill; -import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.StatChanged; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigChanged; import net.runelite.client.game.SkillIconManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; +import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; +import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.ImageUtil; @@ -85,6 +90,9 @@ public class BoostsPlugin extends Plugin @Inject private BoostsOverlay boostsOverlay; + @Inject + private CompactBoostsOverlay compactBoostsOverlay; + @Inject private BoostsConfig config; @@ -96,6 +104,9 @@ public class BoostsPlugin extends Plugin private final Set shownSkills = EnumSet.noneOf(Skill.class); + @Getter(AccessLevel.PACKAGE) + private BufferedImage buffed, debuffed; + private boolean isChangedDown = false; private boolean isChangedUp = false; private final int[] lastSkillLevels = new int[Skill.values().length - 1]; @@ -113,14 +124,23 @@ public class BoostsPlugin extends Plugin @Override protected void startUp() throws Exception { + OverlayMenuEntry menuEntry = new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay"); + + boostsOverlay.getMenuEntries().add(menuEntry); + compactBoostsOverlay.getMenuEntries().add(menuEntry);; + overlayManager.add(boostsOverlay); + overlayManager.add(compactBoostsOverlay); updateShownSkills(); Arrays.fill(lastSkillLevels, -1); + buffed = ImageUtil.loadImageResource(getClass(), "buffed.png"); + debuffed = ImageUtil.loadImageResource(getClass(), "debuffed.png"); + // Add infoboxes for everything at startup and then determine inside if it will be rendered - infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.loadImageResource(getClass(), "debuffed.png"), this, config)); - infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.loadImageResource(getClass(), "buffed.png"), this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(true, buffed, this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(false, debuffed, this, config)); for (final Skill skill : Skill.values()) { @@ -134,7 +154,10 @@ public class BoostsPlugin extends Plugin @Override protected void shutDown() throws Exception { + boostsOverlay.getMenuEntries().clear(); + compactBoostsOverlay.getMenuEntries().clear(); overlayManager.remove(boostsOverlay); + overlayManager.remove(compactBoostsOverlay); infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator); preserveBeenActive = false; lastChangeDown = -1; @@ -142,6 +165,7 @@ public class BoostsPlugin extends Plugin isChangedUp = false; isChangedDown = false; skillsToDisplay.clear(); + buffed = debuffed = null; } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java new file mode 100644 index 0000000000..828feef03d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2022, 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.boosts; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.util.Set; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Skill; +import net.runelite.client.game.SkillIconManager; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.OverlayPriority; + +class CompactBoostsOverlay extends Overlay +{ + private final Client client; + private final BoostsConfig config; + private final BoostsPlugin plugin; + private final SkillIconManager skillIconManager; + + private int curY; + private int maxX; + + @Inject + private CompactBoostsOverlay(Client client, BoostsConfig config, BoostsPlugin plugin, SkillIconManager skillIconManager) + { + super(plugin); + this.client = client; + this.config = config; + this.plugin = plugin; + this.skillIconManager = skillIconManager; + setPosition(OverlayPosition.TOP_LEFT); + setPriority(OverlayPriority.MED); + } + + @Override + public Dimension render(Graphics2D graphics) + { + final Set boostedSkills = plugin.getSkillsToDisplay(); + if (boostedSkills.isEmpty() || !config.compactDisplay()) + { + return null; + } + + curY = maxX = 0; + + final FontMetrics fontMetrics = graphics.getFontMetrics(); + final int fontHeight = fontMetrics.getHeight(); + for (Skill skill : boostedSkills) + { + final int boosted = client.getBoostedSkillLevel(skill); + final int base = client.getRealSkillLevel(skill); + final int boost = boosted - base; + + if (boost == 0) + { + continue; + } + + drawBoost(graphics, fontMetrics, fontHeight, + skillIconManager.getSkillImage(skill, true), + getTextColor(boost), + getBoostText(boost, base, boosted)); + } + + int time = plugin.getChangeUpTicks(); + if (time != -1) + { + drawBoost(graphics, fontMetrics, fontHeight, + plugin.getBuffed(), + time < 10 ? Color.RED.brighter() : Color.WHITE, + String.format("%02d", plugin.getChangeTime(time))); + } + + time = plugin.getChangeDownTicks(); + if (time != -1) + { + drawBoost(graphics, fontMetrics, fontHeight, + plugin.getDebuffed(), + time < 10 ? Color.RED.brighter() : Color.WHITE, + String.format("%02d", plugin.getChangeTime(time))); + } + + return new Dimension(maxX, curY); + } + + private void drawBoost(Graphics2D graphics, FontMetrics fontMetrics, int fontHeight, BufferedImage image, Color color, String text) + { + graphics.drawImage(image, 0, curY, null); + + // add a little bit of padding to get the text off the side of the image + final int x = image.getWidth() + 6; + graphics.setColor(color); + graphics.drawString(text, x, + // this really should be y + (image.getHeight() / 2) + (fontHeight / 2), but in practice + // it is the same + curY + fontHeight); + + curY += Math.max(image.getHeight(), fontHeight) + + 1; // padding to keep images from touching + maxX = Math.max(maxX, x + fontMetrics.stringWidth(text)); + } + + private String getBoostText(int boost, int base, int boosted) + { + if (config.useRelativeBoost()) + { + return boost > 0 ? "+" + boost : "-" + boost; + } + else + { + return Integer.toString(boosted); + } + } + + private Color getTextColor(int boost) + { + if (boost < 0) + { + return new Color(238, 51, 51); + } + + return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN; + } +} From ec79cca1308d5f32e24b97b3099d7470d1f64e21 Mon Sep 17 00:00:00 2001 From: Hexagon Date: Sat, 18 Jun 2022 12:21:10 -0300 Subject: [PATCH 11/13] spec-counter: reset counter on sotetseg maze --- .../src/main/java/net/runelite/api/ScriptID.java | 6 ++++++ .../specialcounter/SpecialCounterPlugin.java | 14 +++++++++++++- 2 files changed, 19 insertions(+), 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 97355b7fd7..d001581390 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -383,4 +383,10 @@ public final class ScriptID */ @ScriptArguments(integer = 6) public static final int TRADE_MAIN_INIT = 755; + + /** + * Transitions the tob hud into the white flash that happens when sotetseg teleports the players to the maze. + */ + @ScriptArguments(string = 1) + public static final int TOB_HUD_SOTETSEG_FADE = 2308; } \ No newline at end of file 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 f308fd1525..0ed6652019 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 @@ -48,6 +48,7 @@ import net.runelite.api.Item; import net.runelite.api.ItemContainer; import net.runelite.api.NPC; import net.runelite.api.NpcID; +import net.runelite.api.ScriptID; import net.runelite.api.VarPlayer; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.CommandExecuted; @@ -56,6 +57,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.NpcDespawned; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.VarbitChanged; import net.runelite.client.Notifier; import net.runelite.client.callback.ClientThread; @@ -166,7 +168,17 @@ public class SpecialCounterPlugin extends Plugin overlayManager.remove(playerInfoDropOverlay); wsClient.unregisterMessage(SpecialCounterUpdate.class); } - + + @Subscribe + public void onScriptPostFired(ScriptPostFired event) + { + if (event.getScriptId() == ScriptID.TOB_HUD_SOTETSEG_FADE) + { + log.debug("Resetting spec counter as sotetseg maze script was ran"); + removeCounters(); + } + } + @Subscribe public void onGameTick(GameTick event) { From d89a64505b2e749719b580fc105e268e064933c8 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 19 Jun 2022 14:09:42 -0400 Subject: [PATCH 12/13] boosts: right justify compact overlay text Also replace buff/debuff images with one that is sized 16x16 similar to the small skill icons, so that the text aligns properly too. --- .../client/plugins/boosts/BoostsPlugin.java | 13 +----- .../plugins/boosts/CompactBoostsOverlay.java | 37 ++++++++++++------ .../client/plugins/boosts/buffedsmall.png | Bin 0 -> 580 bytes .../client/plugins/boosts/debuffedsmall.png | Bin 0 -> 625 bytes 4 files changed, 28 insertions(+), 22 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedsmall.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedsmall.png 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 02f23a8776..cd47e26719 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 @@ -26,13 +26,11 @@ package net.runelite.client.plugins.boosts; import com.google.common.collect.ImmutableSet; import com.google.inject.Provides; -import java.awt.image.BufferedImage; import java.util.Arrays; import java.util.EnumSet; import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; -import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.Client; import net.runelite.api.Constants; @@ -104,9 +102,6 @@ public class BoostsPlugin extends Plugin private final Set shownSkills = EnumSet.noneOf(Skill.class); - @Getter(AccessLevel.PACKAGE) - private BufferedImage buffed, debuffed; - private boolean isChangedDown = false; private boolean isChangedUp = false; private final int[] lastSkillLevels = new int[Skill.values().length - 1]; @@ -135,12 +130,9 @@ public class BoostsPlugin extends Plugin updateShownSkills(); Arrays.fill(lastSkillLevels, -1); - buffed = ImageUtil.loadImageResource(getClass(), "buffed.png"); - debuffed = ImageUtil.loadImageResource(getClass(), "debuffed.png"); - // Add infoboxes for everything at startup and then determine inside if it will be rendered - infoBoxManager.addInfoBox(new StatChangeIndicator(true, buffed, this, config)); - infoBoxManager.addInfoBox(new StatChangeIndicator(false, debuffed, this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.loadImageResource(getClass(), "buffed.png"), this, config)); + infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.loadImageResource(getClass(), "debuffed.png"), this, config)); for (final Skill skill : Skill.values()) { @@ -165,7 +157,6 @@ public class BoostsPlugin extends Plugin isChangedUp = false; isChangedDown = false; skillsToDisplay.clear(); - buffed = debuffed = null; } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java index 828feef03d..ee66149dda 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CompactBoostsOverlay.java @@ -28,6 +28,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.image.BufferedImage; import java.util.Set; import javax.inject.Inject; @@ -37,9 +38,17 @@ import net.runelite.client.game.SkillIconManager; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.components.TextComponent; +import net.runelite.client.util.ImageUtil; class CompactBoostsOverlay extends Overlay { + private static final int H_PADDING = 2; + private static final int V_PADDING = 1; + private static final int TEXT_WIDTH = 22; + private static final BufferedImage BUFFED = ImageUtil.loadImageResource(CompactBoostsOverlay.class, "buffedsmall.png"); + private static final BufferedImage DEBUFFED = ImageUtil.loadImageResource(CompactBoostsOverlay.class, "debuffedsmall.png"); + private final Client client; private final BoostsConfig config; private final BoostsPlugin plugin; @@ -94,18 +103,18 @@ class CompactBoostsOverlay extends Overlay if (time != -1) { drawBoost(graphics, fontMetrics, fontHeight, - plugin.getBuffed(), + BUFFED, time < 10 ? Color.RED.brighter() : Color.WHITE, - String.format("%02d", plugin.getChangeTime(time))); + Integer.toString(plugin.getChangeTime(time))); } time = plugin.getChangeDownTicks(); if (time != -1) { drawBoost(graphics, fontMetrics, fontHeight, - plugin.getDebuffed(), + DEBUFFED, time < 10 ? Color.RED.brighter() : Color.WHITE, - String.format("%02d", plugin.getChangeTime(time))); + Integer.toString(plugin.getChangeTime(time))); } return new Dimension(maxX, curY); @@ -115,17 +124,23 @@ class CompactBoostsOverlay extends Overlay { graphics.drawImage(image, 0, curY, null); - // add a little bit of padding to get the text off the side of the image - final int x = image.getWidth() + 6; - graphics.setColor(color); - graphics.drawString(text, x, + final int stringWidth = fontMetrics.stringWidth(text); + final TextComponent textComponent = new TextComponent(); + textComponent.setColor(color); + textComponent.setText(text); + textComponent.setOutline(true); + textComponent.setPosition(new Point( + image.getWidth() + + H_PADDING // add a little bit of padding to get the text off the side of the image + + (TEXT_WIDTH - stringWidth), // right justify to TEXT_WIDTH // this really should be y + (image.getHeight() / 2) + (fontHeight / 2), but in practice // it is the same - curY + fontHeight); + curY + fontHeight)); + textComponent.render(graphics); curY += Math.max(image.getHeight(), fontHeight) - + 1; // padding to keep images from touching - maxX = Math.max(maxX, x + fontMetrics.stringWidth(text)); + + V_PADDING; // padding to keep images from touching + maxX = Math.max(maxX, image.getWidth() + H_PADDING + TEXT_WIDTH); } private String getBoostText(int boost, int base, int boosted) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedsmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedsmall.png new file mode 100644 index 0000000000000000000000000000000000000000..f4757d0ca34a874a85c5545bf4768a0c98185983 GIT binary patch literal 580 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47!?A1LR^7dAX89SP)A3bhnpLS z>_Q!ZBv2Gcx_i3=Wr2v9nHk8{7Z*1W7uOaOV`5_VR#XIv0Fji8p@5(SP>rUkmX4Wj z>9U&6Wj&T2R#TTuowa86{I&DLx}sI>)pflLBId*cjrDBxFZ&;-n;=4R!P}%WB5^r6 zA%%fa&C^peO^nSVA$9V!X%kb~H(NH$nC$Hr=NQPTbb$BBn^Rh=R%Hb+%57*^wQHAF zNW=90c!vOHl?9xF0z%g=g@v+mu2|K?T2ivL(T0Pe`$eWQXGcee(Fz-Mh!dH68#x z!e3C%&%(*V+HKs@($?1M?&9X=di=<-V@JIi81|f3t>VZ`-2wCkgQu&X%Q~loCIEjp Bo+|(V literal 0 HcmV?d00001 diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedsmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedsmall.png new file mode 100644 index 0000000000000000000000000000000000000000..6e02339e742b51b20f5365e83fba40f081dac984 GIT binary patch literal 625 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47`*~~LR^7dAX89SP)A3bhnpM7 z0g`s1j&QcSw>wY)5HT||0|oWP#SO&8wZ+7kn3%m46@el^Bqd`gASeM;qiL$8W2RfW ztfq5WkEMsz)Fo4At(iT4?fkH=XjOZ4T`z-(Iq`ifCU~~`x6WzxZ1L0a&4pOO*uq1v7A1 zPvaD}d8o)Q{gh9{B;dx2*H=%viLP7c#}ngN3RJbn)5S4F;&O6A3In5>re!y*;Ncw|?H*7^ Date: Mon, 20 Jun 2022 12:31:04 +0300 Subject: [PATCH 13/13] project: Bump versions --- buildSrc/src/main/kotlin/Dependencies.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 56856151a9..d188ca0b90 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -25,9 +25,9 @@ object ProjectVersions { const val launcherVersion = "3.0.0" - const val rlVersion = "1.8.24.1" + const val rlVersion = "1.8.24.2" - const val openosrsVersion = "4.31.0" + const val openosrsVersion = "4.31.1" const val rsversion = 206 const val cacheversion = 165