From 5ee801679eb84e9885297d47535c3940aa252f22 Mon Sep 17 00:00:00 2001 From: adwitkow Date: Sat, 29 Feb 2020 20:26:33 +0100 Subject: [PATCH 01/28] worldmap: add targets to Wilderness Levers & clarify their tooltips --- .../plugins/worldmap/TransportationPointLocation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 b1ea7baf2a..9c67107d27 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,9 +192,9 @@ enum TransportationPointLocation MUSHTREE_VERDANT_VALLEY("Mushtree", new WorldPoint(3757, 3756, 0)), MYTHS_GUILD_PORTAL("Portal to Guilds", new WorldPoint(2456, 2856, 0)), TRAIN_KELDAGRIM("Railway Station", new WorldPoint(2941, 10179, 0)), - WILDERNESS_LEVER_ARDOUGNE("Wilderness Lever", new WorldPoint(2559, 3309, 0)), - WILDERNESS_LEVER_EDGEVILLE("Wilderness Lever", new WorldPoint(3088, 3474, 0)), - WILDERNESS_LEVER_WILDERNESS("Wilderness Lever", new WorldPoint(3154, 3924, 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)), + WILDERNESS_LEVER_WILDERNESS("Wilderness Lever to Ardougne/Edgeville", new WorldPoint(3154, 3924, 0)); private final String tooltip; private final WorldPoint location; From d69cc6160fae444655fcb63bf424a11a9809a6b0 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 5 Mar 2020 12:42:58 +0000 Subject: [PATCH 02/28] Release 1.6.9 --- 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 5c8415749b..53ba96ddee 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index ef4fc35300..3db6384452 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 3c21dbd30e..097a2dd421 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index a32684a868..3d71d13bdb 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 191c735f3a..329d8b2a1c 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 Web Service diff --git a/pom.xml b/pom.xml index 0b132d205a..6f37573d8b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 pom RuneLite @@ -60,7 +60,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.9 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 243314eccd..0d9838792f 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 3595cd1834..5b2dfadacd 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9-SNAPSHOT + 1.6.9 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 275e34b3c8..0b4e468d5d 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.9-SNAPSHOT + 1.6.9 script-assembler-plugin From 962d0cde4d5baa644799dc5885f1d464d0209b9f Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 5 Mar 2020 12:43:06 +0000 Subject: [PATCH 03/28] Bump for 1.6.10-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 53ba96ddee..7704cc1604 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 3db6384452..9c9847557d 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 097a2dd421..1c3caf8802 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 3d71d13bdb..6aee0ecc98 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 329d8b2a1c..98c70e6c50 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 6f37573d8b..ed2af76b40 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT pom RuneLite @@ -60,7 +60,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.6.9 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 0d9838792f..6b77242ec7 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 5b2dfadacd..d9bd9b259e 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.6.9 + 1.6.10-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 0b4e468d5d..626201cd7b 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.9 + 1.6.10-SNAPSHOT script-assembler-plugin From 5a6072de81865d593c8303bfad19c88f52217c47 Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Thu, 5 Mar 2020 13:34:49 -0500 Subject: [PATCH 04/28] agility: set lastObstacleXp to 0 on courses that use worldpoints --- .../java/net/runelite/client/plugins/agility/Courses.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java index 339ba15f3c..1193368164 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java @@ -33,8 +33,8 @@ enum Courses { GNOME(86.5, 46, 9781), DRAYNOR(120.0, 79, 12338), - AL_KHARID(180.0, 30, 13105, new WorldPoint(3299, 3194, 0)), - PYRAMID(722.0, 300, 13356, new WorldPoint(3364, 2830, 0)), + AL_KHARID(180.0, 0, 13105, new WorldPoint(3299, 3194, 0)), + PYRAMID(722.0, 0, 13356, new WorldPoint(3364, 2830, 0)), VARROCK(238.0, 125, 12853), PENGUIN(540.0, 65, 10559), BARBARIAN(139.5, 60, 10039), From 15160270018e34d8693071b68d87cde5d08571e9 Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Mon, 30 Sep 2019 12:30:36 -0400 Subject: [PATCH 05/28] agility: account for bonus exp from agility pyramid --- .../runelite/client/plugins/agility/AgilitySession.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java index 2b8c46d7b1..c42b8fc250 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java @@ -53,8 +53,15 @@ class AgilitySession final int currentExp = client.getSkillExperience(Skill.AGILITY); final int goalXp = xpTrackerService.getEndGoalXp(Skill.AGILITY); final int goalRemainingXp = goalXp - currentExp; + double courseTotalExp = course.getTotalXp(); + if (course == Courses.PYRAMID) + { + // agility pyramid has a bonus exp drop on the last obstacle that scales with player level and caps at 1000 + // the bonus is not already accounted for in the total exp number in the courses enum + courseTotalExp += Math.min(300 + 8 * client.getRealSkillLevel(Skill.AGILITY), 1000); + } - lapsTillGoal = goalRemainingXp > 0 ? (int) Math.ceil(goalRemainingXp / course.getTotalXp()) : 0; + lapsTillGoal = goalRemainingXp > 0 ? (int) Math.ceil(goalRemainingXp / courseTotalExp) : 0; } void resetLapCount() From 23a1f517cd85e4f6e2552a5d041476686586423e Mon Sep 17 00:00:00 2001 From: ThatGamerBlue Date: Wed, 4 Mar 2020 01:28:53 +0000 Subject: [PATCH 06/28] rlapi: MessageNode extends CacheableNode (but Node is close enough) --- runelite-api/src/main/java/net/runelite/api/MessageNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/MessageNode.java b/runelite-api/src/main/java/net/runelite/api/MessageNode.java index 3419d955ac..9ff1385b3b 100644 --- a/runelite-api/src/main/java/net/runelite/api/MessageNode.java +++ b/runelite-api/src/main/java/net/runelite/api/MessageNode.java @@ -27,7 +27,7 @@ package net.runelite.api; /** * Represents a message in the chatbox. */ -public interface MessageNode +public interface MessageNode extends Node { /** * Get the id for this message node From dc6942197ea0c6b9ebbe11fcc32a8963d7bffa21 Mon Sep 17 00:00:00 2001 From: ThatGamerBlue Date: Wed, 4 Mar 2020 01:54:32 +0000 Subject: [PATCH 07/28] chatfilter: add filtering by username --- .../plugins/chatfilter/ChatFilterConfig.java | 17 +- .../plugins/chatfilter/ChatFilterPlugin.java | 71 ++++++-- .../chatfilter/ChatFilterPluginTest.java | 156 +++++++++++++++++- 3 files changed, 218 insertions(+), 26 deletions(-) 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 dbdb4d6478..253afd7e18 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 @@ -65,11 +65,22 @@ public interface ChatFilterConfig extends Config return ""; } + @ConfigItem( + keyName = "filteredNames", + name = "Filtered Names", + description = "List of filtered names, one per line. Accepts regular expressions", + position = 4 + ) + default String filteredNames() + { + return ""; + } + @ConfigItem( keyName = "filterFriends", name = "Filter Friends", description = "Filter your friends' messages", - position = 4 + position = 5 ) default boolean filterFriends() { @@ -80,7 +91,7 @@ public interface ChatFilterConfig extends Config keyName = "filterClan", name = "Filter Clan Chat Members", description = "Filter your clan chat members' messages", - position = 5 + position = 6 ) default boolean filterClan() { @@ -91,7 +102,7 @@ public interface ChatFilterConfig extends Config keyName = "filterLogin", name = "Filter Logged In/Out Messages", description = "Filter your private chat to remove logged in/out messages", - position = 6 + position = 7 ) default boolean filterLogin() { 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 fe8fdb18f4..d78f2c8bcd 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 @@ -25,6 +25,7 @@ */ package net.runelite.client.plugins.chatfilter; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.CharMatcher; import com.google.common.base.Splitter; import com.google.inject.Provides; @@ -62,10 +63,12 @@ public class ChatFilterPlugin extends Plugin .omitEmptyStrings() .trimResults(); - private static final String CENSOR_MESSAGE = "Hey, everyone, I just tried to say something very silly!"; + @VisibleForTesting + static final String CENSOR_MESSAGE = "Hey, everyone, I just tried to say something very silly!"; private final CharMatcher jagexPrintableCharMatcher = Text.JAGEX_PRINTABLE_CHAR_MATCHER; private final List filteredPatterns = new ArrayList<>(); + private final List filteredNamePatterns = new ArrayList<>(); @Inject private Client client; @@ -143,7 +146,7 @@ public class ChatFilterPlugin extends Plugin int stringStackSize = client.getStringStackSize(); String message = stringStack[stringStackSize - 1]; - String censoredMessage = censorMessage(message); + String censoredMessage = censorMessage(name, message); if (censoredMessage == null) { @@ -165,7 +168,7 @@ public class ChatFilterPlugin extends Plugin return; } - String message = censorMessage(event.getOverheadText()); + String message = censorMessage(event.getActor().getName(), event.getOverheadText()); if (message == null) { @@ -183,10 +186,23 @@ public class ChatFilterPlugin extends Plugin (config.filterClan() || !clanManager.isClanMember(playerName)); } - String censorMessage(final String message) + String censorMessage(final String username, final String message) { String strippedMessage = jagexPrintableCharMatcher.retainFrom(message) .replace('\u00A0', ' '); + if (shouldFilterByName(username)) + { + switch (config.filterType()) + { + case CENSOR_WORDS: + return StringUtils.repeat('*', strippedMessage.length()); + case CENSOR_MESSAGE: + return CENSOR_MESSAGE; + case REMOVE_MESSAGE: + return null; + } + } + boolean filtered = false; for (Pattern pattern : filteredPatterns) { @@ -199,7 +215,7 @@ public class ChatFilterPlugin extends Plugin switch (config.filterType()) { case CENSOR_WORDS: - m.appendReplacement(sb, StringUtils.repeat("*", m.group(0).length())); + m.appendReplacement(sb, StringUtils.repeat('*', m.group(0).length())); filtered = true; break; case CENSOR_MESSAGE: @@ -219,25 +235,33 @@ public class ChatFilterPlugin extends Plugin void updateFilteredPatterns() { filteredPatterns.clear(); + filteredNamePatterns.clear(); Text.fromCSV(config.filteredWords()).stream() .map(s -> Pattern.compile(Pattern.quote(s), Pattern.CASE_INSENSITIVE)) .forEach(filteredPatterns::add); NEWLINE_SPLITTER.splitToList(config.filteredRegex()).stream() - .map(s -> - { - try - { - return Pattern.compile(s, Pattern.CASE_INSENSITIVE); - } - catch (PatternSyntaxException ex) - { - return null; - } - }) + .map(ChatFilterPlugin::compilePattern) .filter(Objects::nonNull) .forEach(filteredPatterns::add); + + NEWLINE_SPLITTER.splitToList(config.filteredNames()).stream() + .map(ChatFilterPlugin::compilePattern) + .filter(Objects::nonNull) + .forEach(filteredNamePatterns::add); + } + + private static Pattern compilePattern(String pattern) + { + try + { + return Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); + } + catch (PatternSyntaxException ex) + { + return null; + } } @Subscribe @@ -253,4 +277,19 @@ public class ChatFilterPlugin extends Plugin //Refresh chat after config change to reflect current rules client.refreshChat(); } + + @VisibleForTesting + boolean shouldFilterByName(final String playerName) + { + String sanitizedName = Text.standardize(playerName); + for (Pattern pattern : filteredNamePatterns) + { + Matcher m = pattern.matcher(sanitizedName); + if (m.find()) + { + return true; + } + } + return false; + } } 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 949bac892d..07a45e7a29 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 @@ -29,9 +29,14 @@ import com.google.inject.Guice; import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.BoundFieldModule; import javax.inject.Inject; +import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.IterableHashTable; +import net.runelite.api.MessageNode; import net.runelite.api.Player; +import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.client.game.ClanManager; +import static net.runelite.client.plugins.chatfilter.ChatFilterPlugin.CENSOR_MESSAGE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -40,6 +45,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.mockito.junit.MockitoJUnitRunner; @@ -72,16 +78,43 @@ public class ChatFilterPluginTest when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); when(chatFilterConfig.filteredWords()).thenReturn(""); when(chatFilterConfig.filteredRegex()).thenReturn(""); + when(chatFilterConfig.filteredNames()).thenReturn(""); when(client.getLocalPlayer()).thenReturn(localPlayer); } + private ScriptCallbackEvent createCallbackEvent(final String sender, final String chatMessage, final ChatMessageType messageType) + { + ScriptCallbackEvent event = new ScriptCallbackEvent(); + event.setScript(null); + event.setEventName("chatFilterCheck"); + int[] simulatedIntStack = + new int[]{1, messageType.getType(), 1}; // is msg allowed to show, ChatMessageType.PUBLICCHAT, message id + String[] simulatedStringStack = new String[]{chatMessage}; + IterableHashTable messageTable = mock(IterableHashTable.class); + MessageNode mockedMsgNode = mockMessageNode(sender); + when(client.getIntStack()).thenReturn(simulatedIntStack); + when(client.getIntStackSize()).thenReturn(simulatedIntStack.length); + when(client.getStringStack()).thenReturn(simulatedStringStack); + when(client.getStringStackSize()).thenReturn(simulatedStringStack.length); + when(client.getMessages()).thenReturn(messageTable); + when(messageTable.get(1)).thenReturn(mockedMsgNode); + return event; + } + + private MessageNode mockMessageNode(String sender) + { + MessageNode node = mock(MessageNode.class); + when(node.getName()).thenReturn(sender); + return node; + } + @Test public void testCensorWords() { when(chatFilterConfig.filteredWords()).thenReturn("hat"); chatFilterPlugin.updateFilteredPatterns(); - assertEquals("w***s up", chatFilterPlugin.censorMessage("whats up")); + assertEquals("w***s up", chatFilterPlugin.censorMessage("Blue", "whats up")); } @Test @@ -91,7 +124,7 @@ public class ChatFilterPluginTest when(chatFilterConfig.filteredRegex()).thenReturn("5[0-9]x2\n("); chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("55X2 Dicing | Trusted Ranks | Huge Pay Outs!")); + assertNull(chatFilterPlugin.censorMessage("Blue", "55X2 Dicing | Trusted Ranks | Huge Pay Outs!")); } @Test @@ -100,7 +133,7 @@ public class ChatFilterPluginTest when(chatFilterConfig.filteredRegex()).thenReturn("Test\n)\n73"); chatFilterPlugin.updateFilteredPatterns(); - assertEquals("** isn't funny", chatFilterPlugin.censorMessage("73 isn't funny")); + assertEquals("** isn't funny", chatFilterPlugin.censorMessage("Blue", "73 isn't funny")); } @Test @@ -110,8 +143,7 @@ public class ChatFilterPluginTest when(chatFilterConfig.filteredWords()).thenReturn("ReGeX!!!"); chatFilterPlugin.updateFilteredPatterns(); - assertEquals("Hey, everyone, I just tried to say something very silly!", - chatFilterPlugin.censorMessage("I love regex!!!!!!!!")); + assertEquals(CENSOR_MESSAGE, chatFilterPlugin.censorMessage("Blue", "I love regex!!!!!!!!")); } @Test @@ -121,7 +153,7 @@ public class ChatFilterPluginTest when(chatFilterConfig.filteredWords()).thenReturn("test"); chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("te\u008Cst")); + assertNull(chatFilterPlugin.censorMessage("Blue", "te\u008Cst")); } @Test @@ -131,7 +163,7 @@ public class ChatFilterPluginTest when(chatFilterConfig.filteredWords()).thenReturn("hello osrs"); chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("hello\u00A0osrs")); + assertNull(chatFilterPlugin.censorMessage("Blue", "hello\u00A0osrs")); } @Test @@ -180,4 +212,114 @@ public class ChatFilterPluginTest when(clanManager.isClanMember("Woox")).thenReturn(false); assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox")); } + + @Test + public void testShouldFilterByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Gamble [0-9]*"); + + chatFilterPlugin.updateFilteredPatterns(); + assertTrue(chatFilterPlugin.shouldFilterByName("Gamble 1234")); + assertFalse(chatFilterPlugin.shouldFilterByName("Adam")); + } + + @Test + public void testCensorWordsByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Blue"); + chatFilterPlugin.updateFilteredPatterns(); + assertEquals("************", chatFilterPlugin.censorMessage("Blue", "Gamble today")); + } + + @Test + public void textCensorMessageByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Blue"); + chatFilterPlugin.updateFilteredPatterns(); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_MESSAGE); + assertEquals(CENSOR_MESSAGE, + chatFilterPlugin.censorMessage("Blue", "Meet swampletics, my morytania locked ultimate ironman")); + } + + @Test + public void testRemoveMessageByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Blue"); + chatFilterPlugin.updateFilteredPatterns(); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + assertNull( + chatFilterPlugin.censorMessage("Blue", "What about now it's time to rock with the biggity buck bumble")); + } + + @Test + public void testEventRemoveByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Gamble [0-9]*"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Gamble 1234", "filterme", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals(0, client.getIntStack()[client.getIntStackSize() - 3]); + } + + @Test + public void testEventRemoveByText() + { + when(chatFilterConfig.filteredWords()).thenReturn("filterme"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Adam", "please filterme plugin", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals(0, client.getIntStack()[client.getIntStackSize() - 3]); + } + + @Test + public void testEventCensorWordsByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Gamble [0-9]*"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Gamble 1234", "filterme", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals("********", client.getStringStack()[client.getStringStackSize() - 1]); + } + + @Test + public void testEventCensorWordsByText() + { + when(chatFilterConfig.filteredWords()).thenReturn("filterme"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Adam", "please filterme plugin", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals("please ******** plugin", client.getStringStack()[client.getStringStackSize() - 1]); + } + + @Test + public void testEventCensorMessageByName() + { + when(chatFilterConfig.filteredNames()).thenReturn("Gamble [0-9]*"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_MESSAGE); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Gamble 1234", "filterme", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals(CENSOR_MESSAGE, client.getStringStack()[client.getStringStackSize() - 1]); + } + + @Test + public void testEventCensorMessageByText() + { + when(chatFilterConfig.filteredWords()).thenReturn("filterme"); + when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_MESSAGE); + + chatFilterPlugin.updateFilteredPatterns(); + ScriptCallbackEvent event = createCallbackEvent("Adam", "please filterme plugin", ChatMessageType.PUBLICCHAT); + chatFilterPlugin.onScriptCallbackEvent(event); + assertEquals(CENSOR_MESSAGE, client.getStringStack()[client.getStringStackSize() - 1]); + } } \ No newline at end of file From 514325920c9bc6adac45e230915795c6475eb1f4 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Fri, 6 Mar 2020 00:26:35 -0700 Subject: [PATCH 08/28] runelite-client: Make gauntlet timer layoutable --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 6 ++++++ .../src/main/java/net/runelite/api/widgets/WidgetInfo.java | 4 +++- .../java/net/runelite/client/ui/overlay/WidgetOverlay.java | 1 + 3 files changed, 10 insertions(+), 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 97beb54785..2d4e25ba0c 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 @@ -153,6 +153,7 @@ public class WidgetID public static final int LMS_INGAME_GROUP_ID = 328; public static final int ADVENTURE_LOG_ID = 187; public static final int COUNTERS_LOG_GROUP_ID = 625; + public static final int GAUNTLET_TIMER_GROUP_ID = 637; static class WorldMap { @@ -886,4 +887,9 @@ public class WidgetID static final int OWNER = 4; static final int TEXT = 6; } + + static class GauntletTimer + { + static final int CONTAINER = 2; + } } 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 5d54ded21d..dec5f89cf6 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 @@ -513,7 +513,9 @@ public enum WidgetInfo ACHIEVEMENT_DIARY_CONTAINER(WidgetID.ACHIEVEMENT_DIARY_GROUP_ID, WidgetID.AchievementDiary.CONTAINER), - SKILLS_CONTAINER(WidgetID.SKILLS_GROUP_ID, WidgetID.Skills.CONTAINER); + SKILLS_CONTAINER(WidgetID.SKILLS_GROUP_ID, WidgetID.Skills.CONTAINER), + + GAUNTLET_TIMER_CONTAINER(WidgetID.GAUNTLET_TIMER_GROUP_ID, WidgetID.GauntletTimer.CONTAINER); private final int groupId; private final int childId; 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 65fccda1f7..c56e24230a 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 @@ -59,6 +59,7 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER) .put(WidgetInfo.LMS_INFO, OverlayPosition.TOP_CENTER) .put(WidgetInfo.LMS_KDA, OverlayPosition.TOP_CENTER) + .put(WidgetInfo.GAUNTLET_TIMER_CONTAINER, OverlayPosition.TOP_LEFT) .build(); public static Collection createOverlays(final Client client) From 183761cafb88643952551d44283154f32aba3519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Rosseland=20Paulsen?= Date: Fri, 6 Mar 2020 15:35:47 +0100 Subject: [PATCH 09/28] menu swapper: add shift-modifier to bank deposit box --- .../MenuEntrySwapperPlugin.java | 5 +++-- .../menuentryswapper/ShiftDepositMode.java | 17 ++++++++--------- 2 files changed, 11 insertions(+), 11 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 3b3f225267..368b7eb699 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 @@ -47,6 +47,7 @@ import net.runelite.api.events.MenuOpened; import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.PostItemComposition; import net.runelite.api.events.WidgetMenuOptionClicked; +import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; @@ -314,8 +315,8 @@ public class MenuEntrySwapperPlugin extends Plugin && menuEntryAdded.getOption().startsWith("Deposit-")) { ShiftDepositMode shiftDepositMode = config.bankDepositShiftClick(); - final int actionId = shiftDepositMode.getMenuAction().getId(); - final int opId = shiftDepositMode.getIdentifier(); + final int opId = WidgetInfo.TO_GROUP(menuEntryAdded.getActionParam1()) == WidgetID.DEPOSIT_BOX_GROUP_ID ? shiftDepositMode.getIdentifierDepositBox() : shiftDepositMode.getIdentifier(); + final int actionId = opId >= 6 ? MenuAction.CC_OP_LOW_PRIORITY.getId() : MenuAction.CC_OP.getId(); bankModeSwap(actionId, opId); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftDepositMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftDepositMode.java index da490eb6a6..7b6a9fea0f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftDepositMode.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftDepositMode.java @@ -26,23 +26,22 @@ package net.runelite.client.plugins.menuentryswapper; import lombok.Getter; import lombok.RequiredArgsConstructor; -import net.runelite.api.MenuAction; @Getter @RequiredArgsConstructor public enum ShiftDepositMode { - DEPOSIT_1("Deposit-1", MenuAction.CC_OP, 3), - DEPOSIT_5("Deposit-5", MenuAction.CC_OP, 4), - DEPOSIT_10("Deposit-10", MenuAction.CC_OP, 5), - DEPOSIT_X("Deposit-X", MenuAction.CC_OP_LOW_PRIORITY, 6), - DEPOSIT_ALL("Deposit-All", MenuAction.CC_OP_LOW_PRIORITY, 8), - EXTRA_OP("Eat/Wield/Etc.", MenuAction.CC_OP_LOW_PRIORITY, 9), - OFF("Off", MenuAction.UNKNOWN, 0); + DEPOSIT_1("Deposit-1", 3, 2), + DEPOSIT_5("Deposit-5", 4, 3), + DEPOSIT_10("Deposit-10", 5, 4), + DEPOSIT_X("Deposit-X", 6, 6), + DEPOSIT_ALL("Deposit-All", 8, 5), + EXTRA_OP("Eat/Wield/Etc.", 9, 0), + OFF("Off", 0, 0); private final String name; - private final MenuAction menuAction; private final int identifier; + private final int identifierDepositBox; @Override public String toString() From 8674a4f998ada7708de842ec98e9cc098b4c385c Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 5 Mar 2020 09:08:03 -0500 Subject: [PATCH 10/28] speccounter: use hitsplats for determining spec hit --- .../client/plugins/specialcounter/Boss.java | 28 ++-- .../specialcounter/SpecialCounterPlugin.java | 122 ++++-------------- 2 files changed, 41 insertions(+), 109 deletions(-) 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 index a9b4434797..295194a961 100644 --- 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 @@ -34,25 +34,23 @@ import net.runelite.api.NpcID; @ToString enum Boss { - ABYSSAL_SIRE(1.25d, 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(1.225d, NpcID.CALLISTO, NpcID.CALLISTO_6609), - CERBERUS(1.15d, NpcID.CERBERUS, NpcID.CERBERUS_5863, NpcID.CERBERUS_5866), - CHAOS_ELEMENTAL(1.075d, NpcID.CHAOS_ELEMENTAL, NpcID.CHAOS_ELEMENTAL_6505), - CORPOREAL_BEAST(1.55d, NpcID.CORPOREAL_BEAST), - GENERAL_GRAARDOR(1.325d, NpcID.GENERAL_GRAARDOR, NpcID.GENERAL_GRAARDOR_6494), - GIANT_MOLE(1.075d, NpcID.GIANT_MOLE, NpcID.GIANT_MOLE_6499), - KALPHITE_QUEEN(1.05d, 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(1.075d, NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), - KRIL_TSUROTH(1.375d, NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), - VENETENATIS(1.4d, NpcID.VENENATIS, NpcID.VENENATIS_6610), - VETION(1.225d, NpcID.VETION, NpcID.VETION_REBORN); + 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); private final Set ids; - private final double modifier; // Some NPCs have a modifier to the experience a player receives. - Boss(double modifier, Integer... ids) + Boss(Integer... ids) { - this.modifier = modifier; this.ids = Sets.newHashSet(ids); } 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 ad45a84565..562b263a17 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 @@ -32,19 +32,15 @@ import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.EquipmentInventorySlot; import net.runelite.api.GameState; +import net.runelite.api.Hitsplat; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.Player; -import net.runelite.api.Skill; import net.runelite.api.VarPlayer; -import net.runelite.api.events.FakeXpDrop; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; +import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.StatChanged; import net.runelite.api.events.VarbitChanged; import net.runelite.client.callback.ClientThread; import net.runelite.client.eventbus.Subscribe; @@ -54,7 +50,6 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ws.PartyService; import net.runelite.client.ws.WSClient; -import org.apache.commons.lang3.ArrayUtils; @PluginDescriptor( name = "Special Attack Counter", @@ -66,10 +61,7 @@ public class SpecialCounterPlugin extends Plugin { private int currentWorld = -1; private int specialPercentage = -1; - private int specialHitpointsExperience = -1; - private int specialHitpointsGained = -1; private boolean specialUsed; - private double modifier = 1d; private SpecialWeapon specialWeapon; private final Set interactedNpcIds = new HashSet<>(); @@ -137,105 +129,57 @@ public class SpecialCounterPlugin extends Plugin this.specialPercentage = specialPercentage; this.specialWeapon = usedSpecialWeapon(); - checkInteracting(); - specialUsed = true; - specialHitpointsExperience = client.getSkillExperience(Skill.HITPOINTS); - specialHitpointsGained = -1; } @Subscribe - public void onStatChanged(StatChanged statChanged) + public void onHitsplatApplied(HitsplatApplied hitsplatApplied) { - if (specialUsed && statChanged.getSkill() == Skill.HITPOINTS) - { - specialHitpointsGained = statChanged.getXp() - specialHitpointsExperience; - } - } - - @Subscribe - public void onFakeXpDrop(FakeXpDrop fakeXpDrop) - { - if (specialUsed && fakeXpDrop.getSkill() == Skill.HITPOINTS) - { - specialHitpointsGained = fakeXpDrop.getXp(); - } - } - - @Subscribe - private void onGameTick(GameTick tick) - { - if (client.getGameState() != GameState.LOGGED_IN) + Actor target = hitsplatApplied.getActor(); + Hitsplat hitsplat = hitsplatApplied.getHitsplat(); + if (hitsplat.getHitsplatType() != Hitsplat.HitsplatType.DAMAGE_ME || !(target instanceof NPC)) { return; } - int interactingId = checkInteracting(); - if (interactingId > -1 && specialUsed) - { - int deltaExperience = specialHitpointsGained; + NPC npc = (NPC) target; + int interactingId = npc.getId(); + // If this is a new NPC reset the counters + if (!interactedNpcIds.contains(interactingId)) + { + removeCounters(); + addInteracting(interactingId); + } + + if (specialUsed) + { specialUsed = false; - if (deltaExperience > 0) + if (specialWeapon != null) { - if (specialWeapon != null) + int hit = getHit(specialWeapon, hitsplat); + + updateCounter(specialWeapon, null, hit); + + if (!party.getMembers().isEmpty()) { - int hit = getHit(specialWeapon, deltaExperience); - - updateCounter(specialWeapon, null, hit); - - if (!party.getMembers().isEmpty()) - { - final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(interactingId, specialWeapon, hit); - specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); - wsClient.send(specialCounterUpdate); - } + final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(interactingId, specialWeapon, hit); + specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); + wsClient.send(specialCounterUpdate); } } } } - private int checkInteracting() - { - Player localPlayer = client.getLocalPlayer(); - Actor interacting = localPlayer.getInteracting(); - - if (interacting instanceof NPC) - { - NPC npc = (NPC) interacting; - NPCComposition composition = npc.getComposition(); - int interactingId = npc.getId(); - - if (!ArrayUtils.contains(composition.getActions(), "Attack")) - { - // Skip over non attackable npcs so that eg. talking to bankers doesn't reset - // the counters. - return -1; - } - - if (!interactedNpcIds.contains(interactingId)) - { - removeCounters(); - addInteracting(interactingId); - } - - return interactingId; - } - - return -1; - } - private void addInteracting(int npcId) { - modifier = 1d; interactedNpcIds.add(npcId); // Add alternate forms of bosses final Boss boss = Boss.getBoss(npcId); if (boss != null) { - modifier = boss.getModifier(); interactedNpcIds.addAll(boss.getIds()); } } @@ -356,18 +300,8 @@ public class SpecialCounterPlugin extends Plugin } } - private int getHit(SpecialWeapon specialWeapon, int deltaExperience) + private int getHit(SpecialWeapon specialWeapon, Hitsplat hitsplat) { - double modifierBase = 1d / modifier; - double damageOutput = (deltaExperience * modifierBase) / 1.3333d; - - if (!specialWeapon.isDamage()) - { - return 1; - } - else - { - return (int) Math.round(damageOutput); - } + return specialWeapon.isDamage() ? hitsplat.getAmount() : 1; } } \ No newline at end of file From 34df2aaec05eaf3ab4564ec580011b6fea7fc0a7 Mon Sep 17 00:00:00 2001 From: raqes Date: Sun, 27 May 2018 20:56:49 +0200 Subject: [PATCH 11/28] interface styles: Fix 2005 prayer tab fixed viewport --- .../runelite/client/plugins/interfacestyles/WidgetOffset.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java index ea519dbf0e..739e0bf33c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java @@ -127,7 +127,7 @@ enum WidgetOffset FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null), FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null), - FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null), + FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 181, null, 30, null), FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null), FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null), From a5010517d06f975b0d105b970f120d9647cd4593 Mon Sep 17 00:00:00 2001 From: raqes Date: Sun, 27 May 2018 20:58:26 +0200 Subject: [PATCH 12/28] interface styles: Add 2006 interface Closes runelite/runelite#7581 Co-authored-by: Jordan Atwood --- .../InterfaceStylesPlugin.java | 17 ++++++-- .../client/plugins/interfacestyles/Skin.java | 9 +++- .../interfacestyles/SpriteOverride.java | 43 ++++++++++--------- .../plugins/interfacestyles/WidgetOffset.java | 34 ++++++++++++++- 4 files changed, 76 insertions(+), 27 deletions(-) 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 a7570dc9d1..c54bb0a7fa 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 @@ -182,13 +182,17 @@ public class InterfaceStylesPlugin extends Plugin private void overrideSprites() { + final Skin configuredSkin = config.skin(); for (SpriteOverride spriteOverride : SpriteOverride.values()) { for (Skin skin : spriteOverride.getSkin()) { - if (skin == config.skin()) + if (skin == configuredSkin) { - String file = config.skin().toString() + "/" + spriteOverride.getSpriteID() + ".png"; + final String configSkin = skin.getExtendSkin() != null + ? skin.getExtendSkin().toString() + : skin.toString(); + String file = configSkin + "/" + spriteOverride.getSpriteID() + ".png"; SpritePixels spritePixels = getFileSpritePixels(file); if (spriteOverride.getSpriteID() == SpriteID.COMPASS_TEXTURE) @@ -216,11 +220,16 @@ public class InterfaceStylesPlugin extends Plugin private void overrideWidgetSprites() { + final Skin configuredSkin = config.skin(); for (WidgetOverride widgetOverride : WidgetOverride.values()) { - if (widgetOverride.getSkin() == config.skin()) + if (widgetOverride.getSkin() == configuredSkin + || widgetOverride.getSkin() == configuredSkin.getExtendSkin()) { - String file = config.skin().toString() + "/widget/" + widgetOverride.getName() + ".png"; + final String configSkin = configuredSkin.getExtendSkin() != null + ? configuredSkin.getExtendSkin().toString() + : configuredSkin.toString(); + String file = configSkin + "/widget/" + widgetOverride.getName() + ".png"; SpritePixels spritePixels = getFileSpritePixels(file); if (spritePixels != null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java index c041ffedc2..7e45fd6a64 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java @@ -35,13 +35,20 @@ public enum Skin { DEFAULT("Default"), AROUND_2005("2005"), + AROUND_2006("2006", AROUND_2005), AROUND_2010("2010"); private String name; + private Skin extendSkin; + + Skin(String name) + { + this(name, null); + } @Override public String toString() { return getName(); } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java index 60047b12db..49232a8909 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java @@ -29,6 +29,7 @@ package net.runelite.client.plugins.interfacestyles; import lombok.Getter; import net.runelite.api.SpriteID; import static net.runelite.client.plugins.interfacestyles.Skin.AROUND_2005; +import static net.runelite.client.plugins.interfacestyles.Skin.AROUND_2006; import static net.runelite.client.plugins.interfacestyles.Skin.AROUND_2010; @Getter @@ -96,15 +97,15 @@ enum SpriteOverride MINIMAP_ORB_WORLD_MAP_FRAME(SpriteID.MINIMAP_ORB_WORLD_MAP_FRAME, AROUND_2010), MINIMAP_ORB_WORLD_MAP_PLANET(SpriteID.MINIMAP_ORB_WORLD_MAP_PLANET, AROUND_2010), - //CHATBOX(SpriteID.CHATBOX, AROUND_2005), - CHATBOX_BUTTONS_BACKGROUND_STONES(SpriteID.CHATBOX_BUTTONS_BACKGROUND_STONES, AROUND_2005), - CHATBOX_BUTTON(SpriteID.CHATBOX_BUTTON, AROUND_2005), - CHATBOX_BUTTON_HOVERED(SpriteID.CHATBOX_BUTTON_HOVERED, AROUND_2005), - CHATBOX_BUTTON_NEW_MESSAGES( SpriteID.CHATBOX_BUTTON_NEW_MESSAGES, AROUND_2005), - CHATBOX_BUTTON_SELECTED(SpriteID.CHATBOX_BUTTON_SELECTED, AROUND_2005), - CHATBOX_BUTTON_SELECTED_HOVERED(SpriteID.CHATBOX_BUTTON_SELECTED_HOVERED, AROUND_2005), - CHATBOX_REPORT_BUTTON(SpriteID.CHATBOX_REPORT_BUTTON, AROUND_2005), - CHATBOX_REPORT_BUTTON_HOVERED(SpriteID.CHATBOX_REPORT_BUTTON_HOVERED, AROUND_2005), + //CHATBOX(SpriteID.CHATBOX, AROUND_2005, AROUND_2006), + CHATBOX_BUTTONS_BACKGROUND_STONES(SpriteID.CHATBOX_BUTTONS_BACKGROUND_STONES, AROUND_2005, AROUND_2006), + CHATBOX_BUTTON(SpriteID.CHATBOX_BUTTON, AROUND_2005, AROUND_2006), + CHATBOX_BUTTON_HOVERED(SpriteID.CHATBOX_BUTTON_HOVERED, AROUND_2005, AROUND_2006), + CHATBOX_BUTTON_NEW_MESSAGES( SpriteID.CHATBOX_BUTTON_NEW_MESSAGES, AROUND_2005, AROUND_2006), + CHATBOX_BUTTON_SELECTED(SpriteID.CHATBOX_BUTTON_SELECTED, AROUND_2005, AROUND_2006), + CHATBOX_BUTTON_SELECTED_HOVERED(SpriteID.CHATBOX_BUTTON_SELECTED_HOVERED, AROUND_2005, AROUND_2006), + CHATBOX_REPORT_BUTTON(SpriteID.CHATBOX_REPORT_BUTTON, AROUND_2005, AROUND_2006), + CHATBOX_REPORT_BUTTON_HOVERED(SpriteID.CHATBOX_REPORT_BUTTON_HOVERED, AROUND_2005, AROUND_2006), SCROLLBAR_ARROW_UP(SpriteID.SCROLLBAR_ARROW_UP, AROUND_2005), SCROLLBAR_ARROW_DOWN(SpriteID.SCROLLBAR_ARROW_DOWN, AROUND_2005), @@ -119,20 +120,20 @@ enum SpriteOverride TAB_STONE_BOTTOM_RIGHT_SELECTED(SpriteID.TAB_STONE_BOTTOM_RIGHT_SELECTED, AROUND_2010), TAB_STONE_MIDDLE_SELECTED(SpriteID.TAB_STONE_MIDDLE_SELECTED, AROUND_2010), - FIXED_MODE_SIDE_PANEL_BACKGROUND(SpriteID.FIXED_MODE_SIDE_PANEL_BACKGROUND, AROUND_2005), - FIXED_MODE_TABS_ROW_BOTTOM(SpriteID.FIXED_MODE_TABS_ROW_BOTTOM, AROUND_2005, AROUND_2010), + FIXED_MODE_SIDE_PANEL_BACKGROUND(SpriteID.FIXED_MODE_SIDE_PANEL_BACKGROUND, AROUND_2005, AROUND_2006), + FIXED_MODE_TABS_ROW_BOTTOM(SpriteID.FIXED_MODE_TABS_ROW_BOTTOM, AROUND_2005, AROUND_2006, AROUND_2010), - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER, AROUND_2005, AROUND_2010), - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER, AROUND_2005, AROUND_2010), - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT, AROUND_2005, AROUND_2010), + OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER, AROUND_2005, AROUND_2006, AROUND_2010), + OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER, AROUND_2005, AROUND_2006, AROUND_2010), + OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT, AROUND_2005, AROUND_2006, AROUND_2010), - FIXED_MODE_TABS_TOP_ROW(SpriteID.FIXED_MODE_TABS_TOP_ROW, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_LEFT_EDGE(SpriteID.FIXED_MODE_MINIMAP_LEFT_EDGE, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_RIGHT_EDGE(SpriteID.FIXED_MODE_MINIMAP_RIGHT_EDGE, AROUND_2005, AROUND_2010), - FIXED_MODE_WINDOW_FRAME_EDGE_TOP(SpriteID.FIXED_MODE_WINDOW_FRAME_EDGE_TOP, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_AND_COMPASS_FRAME(SpriteID.FIXED_MODE_MINIMAP_AND_COMPASS_FRAME, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_FRAME_BOTTOM(SpriteID.FIXED_MODE_MINIMAP_FRAME_BOTTOM, AROUND_2005), - FIXED_MODE_TOP_RIGHT_CORNER(SpriteID.FIXED_MODE_TOP_RIGHT_CORNER, AROUND_2005), + FIXED_MODE_TABS_TOP_ROW(SpriteID.FIXED_MODE_TABS_TOP_ROW, AROUND_2005, AROUND_2006, AROUND_2010), + FIXED_MODE_MINIMAP_LEFT_EDGE(SpriteID.FIXED_MODE_MINIMAP_LEFT_EDGE, AROUND_2005, AROUND_2006, AROUND_2010), + FIXED_MODE_MINIMAP_RIGHT_EDGE(SpriteID.FIXED_MODE_MINIMAP_RIGHT_EDGE, AROUND_2005, AROUND_2006, AROUND_2010), + FIXED_MODE_WINDOW_FRAME_EDGE_TOP(SpriteID.FIXED_MODE_WINDOW_FRAME_EDGE_TOP, AROUND_2005, AROUND_2006, AROUND_2010), + FIXED_MODE_MINIMAP_AND_COMPASS_FRAME(SpriteID.FIXED_MODE_MINIMAP_AND_COMPASS_FRAME, AROUND_2005, AROUND_2006, AROUND_2010), + FIXED_MODE_MINIMAP_FRAME_BOTTOM(SpriteID.FIXED_MODE_MINIMAP_FRAME_BOTTOM, AROUND_2005, AROUND_2006), + FIXED_MODE_TOP_RIGHT_CORNER(SpriteID.FIXED_MODE_TOP_RIGHT_CORNER, AROUND_2005, AROUND_2006), RESIZEABLE_MODE_TABS_TOP_ROW(SpriteID.RESIZEABLE_MODE_TABS_TOP_ROW, AROUND_2010), RESIZEABLE_MODE_TABS_BOTTOM_ROW(SpriteID.RESIZEABLE_MODE_TABS_BOTTOM_ROW, AROUND_2010), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java index 739e0bf33c..49593ce66b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java @@ -144,7 +144,39 @@ enum WidgetOffset FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null), FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), - FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null); + FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 5, null, null), + + FIXED_2006_ROOT_INTERFACE_CONTAINER(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_ROOT_INTERFACE_CONTAINER, null, null, 197, null), + FIXED_2006_INTERFACE_CONTAINER(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null), + FIXED_2006_BANK_CONTAINER(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null), + FIXED_2006_COMBAT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null), + FIXED_2006_COMBAT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 26, 1, null, null), + FIXED_2006_STATS_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null), + FIXED_2006_STATS_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 54, null, null, null), + FIXED_2006_QUESTS_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null), + FIXED_2006_QUESTS_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 81, null, null, null), + FIXED_2006_INVENTORY_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null), + FIXED_2006_INVENTORY_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 114, 2, null, null), + FIXED_2006_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), + FIXED_2006_EQUIPMENT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 152, 2, null, null), + FIXED_2006_PRAYER_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 181, null, 30, null), + FIXED_2006_PRAYER_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, 2, null, null), + FIXED_2006_MAGIC_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), + FIXED_2006_MAGIC_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 207, 4, null, null), + FIXED_2006_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null), + FIXED_2006_CLAN_CHAT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, -1, null, null), + FIXED_2006_FRIENDS_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null), + FIXED_2006_FRIENDS_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, 1, null, null), + FIXED_2006_IGNORES_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null), + FIXED_2006_IGNORES_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 76, null, null, null), + FIXED_2006_LOGOUT_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null), + FIXED_2006_LOGOUT_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 113, 2, null, null), + FIXED_2006_OPTIONS_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null), + FIXED_2006_OPTIONS_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 147, null, null, null), + FIXED_2006_EMOTES_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), + FIXED_2006_EMOTES_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 177, null, null, null), + FIXED_2006_MUSIC_HIGHLIGHT(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), + FIXED_2006_MUSIC_ICON(Skin.AROUND_2006, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, -1, null, null); private Skin skin; private WidgetInfo widgetInfo; From 7b453cf263534ae58793fbba62417e09f086b99e Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Tue, 3 Dec 2019 23:21:46 -0500 Subject: [PATCH 13/28] mining: show respawn timers after GameState change --- .../client/plugins/mining/MiningOverlay.java | 21 +++++++------------ .../client/plugins/mining/MiningPlugin.java | 2 +- .../client/plugins/mining/RockRespawn.java | 5 +++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java index 85a6897c5f..9da2bbcca7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java @@ -28,14 +28,12 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.time.Instant; -import java.util.Iterator; import java.util.List; import javax.inject.Inject; 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.coords.WorldPoint; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; @@ -72,24 +70,18 @@ class MiningOverlay extends Overlay } Instant now = Instant.now(); - for (Iterator it = respawns.iterator(); it.hasNext();) + for (RockRespawn rockRespawn : respawns) { - Color pieFillColor = Color.YELLOW; - Color pieBorderColor = Color.ORANGE; - RockRespawn rockRespawn = it.next(); - float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime(); - WorldPoint worldPoint = rockRespawn.getWorldPoint(); - LocalPoint loc = LocalPoint.fromWorld(client, worldPoint); - if (loc == null || percent > 1.0f) + LocalPoint loc = LocalPoint.fromWorld(client, rockRespawn.getWorldPoint()); + if (loc == null) { - it.remove(); continue; } + float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime(); Point point = Perspective.localToCanvas(client, loc, client.getPlane(), rockRespawn.getZOffset()); - if (point == null) + if (point == null || percent > 1.0f) { - it.remove(); continue; } @@ -102,6 +94,9 @@ class MiningOverlay extends Overlay continue; } + Color pieFillColor = Color.YELLOW; + Color pieBorderColor = Color.ORANGE; + // Recolour pie on motherlode veins during the portion of the timer where they may respawn if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java index 5ff4b1ff7f..c968a4b9cb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java @@ -94,7 +94,6 @@ public class MiningPlugin extends Plugin { switch (event.getGameState()) { - case LOADING: case HOPPING: respawns.clear(); break; @@ -110,6 +109,7 @@ public class MiningPlugin extends Plugin @Subscribe public void onGameTick(GameTick gameTick) { + respawns.removeIf(RockRespawn::isExpired); recentlyLoggedIn = false; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java index daedda8f34..c2a33717bc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java @@ -38,4 +38,9 @@ class RockRespawn private final Instant startTime; private final int respawnTime; private final int zOffset; + + boolean isExpired() + { + return Instant.now().isAfter(startTime.plusMillis(respawnTime)); + } } From 7b1819a207e8010ac3f8d4e9d0822d5f9c728cba Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Wed, 11 Dec 2019 14:49:03 -0500 Subject: [PATCH 14/28] mining: add Lovakite rocks --- .../client/plugins/mining/MiningOverlay.java | 10 ++++++++-- .../client/plugins/mining/MiningPlugin.java | 19 +++++++++++++++++++ .../runelite/client/plugins/mining/Rock.java | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java index 9da2bbcca7..df000638ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java @@ -45,6 +45,11 @@ class MiningOverlay extends Overlay static final int ORE_VEIN_MAX_RESPAWN_TIME = 277; // Game ticks private static final int ORE_VEIN_MIN_RESPAWN_TIME = 150; // Game ticks private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME; + + static final int LOVAKITE_ORE_MAX_RESPAWN_TIME = 65; // Game ticks + private static final int LOVAKITE_ORE_MIN_RESPAWN_TIME = 50; // Game ticks + private static final float LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD = (float) LOVAKITE_ORE_MIN_RESPAWN_TIME / LOVAKITE_ORE_MAX_RESPAWN_TIME; + private static final Color DARK_GREEN = new Color(0, 100, 0); private static final int MOTHERLODE_UPPER_FLOOR_HEIGHT = -500; @@ -97,8 +102,9 @@ class MiningOverlay extends Overlay Color pieFillColor = Color.YELLOW; Color pieBorderColor = Color.ORANGE; - // Recolour pie on motherlode veins during the portion of the timer where they may respawn - if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD) + // Recolour pie on motherlode veins or Lovakite ore during the portion of the timer where they may respawn + if ((rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD) + || (rock == Rock.LOVAKITE && percent > LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD)) { pieFillColor = Color.GREEN; pieBorderColor = DARK_GREEN; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java index c968a4b9cb..be0bdcee70 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java @@ -45,6 +45,7 @@ import static net.runelite.api.ObjectID.ORE_VEIN_26664; import net.runelite.api.WallObject; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GameObjectDespawned; +import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.WallObjectSpawned; @@ -132,6 +133,24 @@ public class MiningPlugin extends Plugin } } + @Subscribe + public void onGameObjectSpawned(GameObjectSpawned event) + { + if (client.getGameState() != GameState.LOGGED_IN) + { + return; + } + + GameObject object = event.getGameObject(); + + // If the Lovakite ore respawns before the timer is up, remove it + if (Rock.getRock(object.getId()) == Rock.LOVAKITE) + { + final WorldPoint point = object.getWorldLocation(); + respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point)); + } + } + @Subscribe public void onWallObjectSpawned(WallObjectSpawned event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java index dabe0ececc..8dc2bdac7b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java @@ -72,6 +72,7 @@ enum Rock return region == MINING_GUILD ? Duration.of(100, GAME_TICKS) : super.respawnTime; } }, + LOVAKITE(Duration.of(MiningOverlay.LOVAKITE_ORE_MAX_RESPAWN_TIME, GAME_TICKS), 0, ROCKS_28596, ROCKS_28597), ADAMANTITE(Duration.of(400, GAME_TICKS), 0, ROCKS_11374, ROCKS_11375, ROCKS_36208) { @Override From d19e125998daf43ab9e6274e9ea8af7d677c62e9 Mon Sep 17 00:00:00 2001 From: Trevor Date: Fri, 6 Mar 2020 11:47:58 -0500 Subject: [PATCH 15/28] client: add session and config file arguments --- .../java/net/runelite/client/RuneLite.java | 58 ++++++++++++++++++- .../net/runelite/client/RuneLiteModule.java | 8 ++- .../client/account/SessionManager.java | 27 +++++---- .../runelite/client/config/ConfigManager.java | 14 +++-- .../client/config/ConfigManagerTest.java | 11 ++++ .../client/plugins/PluginManagerTest.java | 10 +++- .../loottracker/LootTrackerPluginTest.java | 5 ++ .../motherlode/MotherlodePluginTest.java | 5 ++ .../npchighlight/NpcIndicatorsPluginTest.java | 5 ++ .../client/plugins/raids/RaidsPluginTest.java | 14 ++++- .../screenshot/ScreenshotPluginTest.java | 5 ++ 11 files changed, 138 insertions(+), 24 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index cb1ffd5ee2..5ea49d8640 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -33,6 +33,7 @@ import com.google.inject.Injector; import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; +import java.nio.file.Paths; import java.util.Locale; import javax.annotation.Nullable; import javax.inject.Provider; @@ -41,6 +42,8 @@ import javax.swing.SwingUtilities; import joptsimple.ArgumentAcceptingOptionSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; +import joptsimple.ValueConversionException; +import joptsimple.ValueConverter; import joptsimple.util.EnumConverter; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -52,12 +55,12 @@ import net.runelite.client.chat.CommandManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.discord.DiscordService; import net.runelite.client.eventbus.EventBus; +import net.runelite.client.externalplugins.ExternalPluginManager; import net.runelite.client.game.ClanManager; import net.runelite.client.game.ItemManager; import net.runelite.client.game.LootManager; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.menus.MenuManager; -import net.runelite.client.externalplugins.ExternalPluginManager; import net.runelite.client.plugins.PluginManager; import net.runelite.client.rs.ClientLoader; import net.runelite.client.rs.ClientUpdateCheckMode; @@ -85,6 +88,8 @@ public class RuneLite public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles"); public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots"); public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs"); + public static final String DEFAULT_SESSION_FILE = "session"; + public static final String DEFAULT_CONFIG_FILE = "settings.properties"; @Getter private static Injector injector; @@ -173,6 +178,14 @@ public class RuneLite parser.accepts("developer-mode", "Enable developer tools"); parser.accepts("debug", "Show extra debugging output"); + final ArgumentAcceptingOptionSpec sessionfile = parser.accepts("sessionfile", "Use a specified session file") + .withRequiredArg().defaultsTo(DEFAULT_SESSION_FILE) + .withValuesConvertedBy(new ConfigFileConverter()); + + final ArgumentAcceptingOptionSpec configfile = parser.accepts("config", "Use a specified config file") + .withRequiredArg().defaultsTo(DEFAULT_CONFIG_FILE) + .withValuesConvertedBy(new ConfigFileConverter()); + final ArgumentAcceptingOptionSpec updateMode = parser .accepts("rs", "Select client type") .withRequiredArg() @@ -246,7 +259,9 @@ public class RuneLite injector = Guice.createInjector(new RuneLiteModule( clientLoader, - developerMode)); + developerMode, + options.valueOf(sessionfile), + options.valueOf(configfile))); injector.getInstance(RuneLite.class).start(); @@ -363,4 +378,43 @@ public class RuneLite { RuneLite.injector = injector; } + + private static class ConfigFileConverter implements ValueConverter + { + @Override + public File convert(String fileName) + { + final File file; + + if (Paths.get(fileName).isAbsolute() + || fileName.startsWith("./") + || fileName.startsWith(".\\")) + { + file = new File(fileName); + } + else + { + file = new File(RuneLite.RUNELITE_DIR, fileName); + } + + if (file.exists() && (!file.isFile() || !file.canWrite())) + { + throw new ValueConversionException(String.format("File %s is not accessible", file.getAbsolutePath())); + } + + return file; + } + + @Override + public Class valueType() + { + return File.class; + } + + @Override + public String valuePattern() + { + return null; + } + } } 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 56076b3368..0434f54abf 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLiteModule.java @@ -61,17 +61,23 @@ public class RuneLiteModule extends AbstractModule private final Supplier clientLoader; private final boolean developerMode; + private final File sessionfile; + private final File config; - public RuneLiteModule(Supplier clientLoader, boolean developerMode) + public RuneLiteModule(Supplier clientLoader, boolean developerMode, File sessionfile, File config) { this.clientLoader = clientLoader; this.developerMode = developerMode; + this.sessionfile = sessionfile; + this.config = config; } @Override protected void configure() { bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode); + bind(File.class).annotatedWith(Names.named("sessionfile")).toInstance(sessionfile); + bind(File.class).annotatedWith(Names.named("config")).toInstance(config); bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor())); bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder() .cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE)) 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 acac9a3b32..a5c45f2591 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 @@ -33,15 +33,15 @@ import java.io.InputStreamReader; import java.time.Instant; import java.util.UUID; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.RuneLite; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.SessionClose; +import net.runelite.client.events.SessionOpen; import net.runelite.client.util.LinkBrowser; import net.runelite.client.ws.WSClient; import net.runelite.http.api.account.AccountClient; @@ -52,27 +52,32 @@ import net.runelite.http.api.ws.messages.LoginResponse; @Slf4j public class SessionManager { - private static final File SESSION_FILE = new File(RuneLite.RUNELITE_DIR, "session"); - @Getter private AccountSession accountSession; private final EventBus eventBus; private final ConfigManager configManager; private final WSClient wsClient; + private final File sessionFile; @Inject - private SessionManager(ConfigManager configManager, EventBus eventBus, WSClient wsClient) + private SessionManager( + @Named("sessionfile") File sessionfile, + ConfigManager configManager, + EventBus eventBus, + WSClient wsClient) { this.configManager = configManager; this.eventBus = eventBus; this.wsClient = wsClient; + this.sessionFile = sessionfile; + eventBus.register(this); } public void loadSession() { - if (!SESSION_FILE.exists()) + if (!sessionFile.exists()) { log.info("No session file exists"); return; @@ -80,7 +85,7 @@ public class SessionManager AccountSession session; - try (FileInputStream in = new FileInputStream(SESSION_FILE)) + try (FileInputStream in = new FileInputStream(sessionFile)) { session = new Gson().fromJson(new InputStreamReader(in), AccountSession.class); @@ -110,11 +115,11 @@ public class SessionManager return; } - try (FileWriter fw = new FileWriter(SESSION_FILE)) + try (FileWriter fw = new FileWriter(sessionFile)) { new Gson().toJson(accountSession, fw); - log.debug("Saved session to {}", SESSION_FILE); + log.debug("Saved session to {}", sessionFile); } catch (IOException ex) { @@ -124,7 +129,7 @@ public class SessionManager private void deleteSession() { - SESSION_FILE.delete(); + sessionFile.delete(); } /** 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 88c4a2e18a..6e7102920f 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 @@ -61,6 +61,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.coords.WorldPoint; @@ -77,7 +78,6 @@ import net.runelite.http.api.config.Configuration; @Slf4j public class ConfigManager { - private static final String SETTINGS_FILE_NAME = "settings.properties"; private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); @Inject @@ -92,11 +92,15 @@ public class ConfigManager private final ConfigInvocationHandler handler = new ConfigInvocationHandler(this); private final Properties properties = new Properties(); private final Map pendingChanges = new HashMap<>(); + private final File settingsFileInput; @Inject - public ConfigManager(ScheduledExecutorService scheduledExecutorService) + public ConfigManager( + @Named("config") File config, + ScheduledExecutorService scheduledExecutorService) { this.executor = scheduledExecutorService; + this.settingsFileInput = config; this.propertiesFile = getPropertiesFile(); executor.scheduleWithFixedDelay(this::sendConfig, 30, 30, TimeUnit.SECONDS); @@ -125,7 +129,7 @@ public class ConfigManager private File getLocalPropertiesFile() { - return new File(RuneLite.RUNELITE_DIR, SETTINGS_FILE_NAME); + return settingsFileInput; } private File getPropertiesFile() @@ -138,7 +142,7 @@ public class ConfigManager else { File profileDir = new File(RuneLite.PROFILES_DIR, session.getUsername().toLowerCase()); - return new File(profileDir, SETTINGS_FILE_NAME); + return new File(profileDir, RuneLite.DEFAULT_CONFIG_FILE); } } @@ -331,7 +335,7 @@ public class ConfigManager parent.mkdirs(); - File tempFile = new File(parent, SETTINGS_FILE_NAME + ".tmp"); + File tempFile = new File(parent, RuneLite.DEFAULT_CONFIG_FILE + ".tmp"); try (FileOutputStream out = new FileOutputStream(tempFile)) { 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 14e4b80f06..d98fee4097 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 @@ -27,11 +27,14 @@ package net.runelite.client.config; import com.google.inject.Guice; import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.BoundFieldModule; +import java.io.File; import java.io.IOException; import java.time.Instant; import java.util.UUID; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; +import javax.inject.Named; +import net.runelite.client.RuneLite; import net.runelite.client.account.AccountSession; import net.runelite.client.eventbus.EventBus; import org.junit.Assert; @@ -56,6 +59,14 @@ public class ConfigManagerTest @Bind RuneLiteConfig runeliteConfig; + @Bind + @Named("sessionfile") + File sessionfile = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE); + + @Bind + @Named("config") + File config = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE); + @Inject ConfigManager manager; 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 99c85db67d..8aaaa9ea86 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,9 +48,9 @@ import java.util.Set; import net.runelite.api.Client; import net.runelite.client.RuneLite; import net.runelite.client.RuneLiteModule; -import net.runelite.client.eventbus.EventBus; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigItem; +import net.runelite.client.eventbus.EventBus; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Rule; @@ -83,7 +83,9 @@ public class PluginManagerTest public void before() throws IOException { Injector injector = Guice.createInjector(Modules - .override(new RuneLiteModule(() -> null, true)) + .override(new RuneLiteModule(() -> null, true, + new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE), + new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE))) .with(BoundFieldModule.of(this))); RuneLite.setInjector(injector); @@ -144,7 +146,9 @@ public class PluginManagerTest { List modules = new ArrayList<>(); modules.add(new GraphvizModule()); - modules.add(new RuneLiteModule(() -> null, true)); + modules.add(new RuneLiteModule(() -> null, true, + new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE), + new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE))); PluginManager pluginManager = new PluginManager(true, null, null, null, null, null); pluginManager.loadCorePlugins(); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java index e28f122305..4cb4e18a8f 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/loottracker/LootTrackerPluginTest.java @@ -34,6 +34,7 @@ import net.runelite.api.Client; import net.runelite.api.Player; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; +import net.runelite.client.account.SessionManager; import net.runelite.client.game.SpriteManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.http.api.loottracker.LootRecordType; @@ -72,6 +73,10 @@ public class LootTrackerPluginTest @Bind private LootTrackerConfig lootTrackerConfig; + @Mock + @Bind + private SessionManager sessionManager; + @Before public void setUp() { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java index 6646ca5aad..3141025604 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java @@ -39,6 +39,7 @@ import net.runelite.api.Varbits; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.VarbitChanged; +import net.runelite.client.ui.overlay.OverlayManager; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -87,6 +88,10 @@ public class MotherlodePluginTest @Bind private ScheduledExecutorService scheduledExecutorService; + @Mock + @Bind + private OverlayManager overlayManager; + @Before public void before() { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java index 6b20c0fc3a..58df1cf936 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.concurrent.ScheduledExecutorService; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.client.ui.overlay.OverlayManager; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -58,6 +59,10 @@ public class NpcIndicatorsPluginTest @Inject private NpcIndicatorsPlugin npcIndicatorsPlugin; + @Mock + @Bind + private OverlayManager overlayManager; + @Before public void setUp() { diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/raids/RaidsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/raids/RaidsPluginTest.java index 01af2080f5..dc03a3e556 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/raids/RaidsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/raids/RaidsPluginTest.java @@ -36,16 +36,18 @@ import net.runelite.api.ItemContainer; import net.runelite.api.ItemID; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.WidgetID; +import net.runelite.client.Notifier; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.game.ItemManager; +import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.util.ImageCapture; +import net.runelite.client.ws.PartyService; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import net.runelite.client.Notifier; -import net.runelite.client.util.ImageCapture; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -98,6 +100,14 @@ public class RaidsPluginTest @Inject RaidsPlugin raidsPlugin; + @Mock + @Bind + private PartyService partyService; + + @Mock + @Bind + private OverlayManager overlayManager; + @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 631e94dcde..b7058d4092 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 @@ -44,6 +44,7 @@ import net.runelite.client.Notifier; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.DrawManager; +import net.runelite.client.ui.overlay.OverlayManager; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -97,6 +98,10 @@ public class ScreenshotPluginTest @Bind ScheduledExecutorService service; + @Mock + @Bind + private OverlayManager overlayManager; + @Before public void before() { From 0a3b42a64a0abbfcc5a3482daf9bdfbdbd29c920 Mon Sep 17 00:00:00 2001 From: Brennan Williams Date: Wed, 26 Feb 2020 16:26:55 +0100 Subject: [PATCH 16/28] shift anti drag: fix default bank drag delay --- .../net/runelite/client/plugins/antidrag/AntiDragPlugin.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java index 196f2846e3..41b025e2aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java @@ -98,8 +98,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener if (e.getKeyCode() == KeyEvent.VK_SHIFT) { client.setInventoryDragDelay(DEFAULT_DELAY); - // In this case, 0 is the default for bank item widgets. - setBankDragDelay(0); + setBankDragDelay(DEFAULT_DELAY); } } @@ -109,7 +108,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener if (!focusChanged.isFocused()) { client.setInventoryDragDelay(DEFAULT_DELAY); - setBankDragDelay(0); + setBankDragDelay(DEFAULT_DELAY); } } From 128c43b10383fdc720825a8d025c557b6cb539c3 Mon Sep 17 00:00:00 2001 From: Ryan Hermstein Date: Fri, 6 Mar 2020 12:48:50 -0500 Subject: [PATCH 17/28] clues: update Eluned cryptic clue message --- .../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 68024e1c6a..dc72d461c0 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 @@ -49,7 +49,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr new CipherClue("ZCZL", "Adam", new WorldPoint(3227, 3227, 0), "Outside Lumbridge castle", "How many snakeskins are needed in order to craft 44 boots, 29 vambraces and 34 bandanas?", "666"), new CipherClue("ZHLUG ROG PDQ", "Weird Old Man", new WorldPoint(3224, 3112, 0), "Kalphite Lair entrance. Fairy ring BIQ", "SIX LEGS! All of them have 6! There are 25 of them! How many legs?", "150"), new CipherClue("ECRVCKP MJCNGF", "Captain Khaled", new WorldPoint(1845, 3754, 0), "Large eastern building in Port Piscarilius", "How many fishing cranes can you find around here?", "5"), - new CipherClue("OVEXON", "Eluned", new WorldPoint(2289, 3144, 0), "Outside Lletya", "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("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"), From 43123e46a3aaa4f41767e9f6f4e65eb40a626be5 Mon Sep 17 00:00:00 2001 From: Trevor Date: Fri, 6 Mar 2020 13:21:23 -0500 Subject: [PATCH 18/28] client: fix default sessionfile/config args --- .../main/java/net/runelite/client/RuneLite.java | 14 ++++++++------ .../net/runelite/client/config/ConfigManager.java | 4 ++-- .../runelite/client/config/ConfigManagerTest.java | 4 ++-- .../runelite/client/plugins/PluginManagerTest.java | 8 ++++---- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index 5ea49d8640..72b6889064 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -88,8 +88,8 @@ public class RuneLite public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles"); public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots"); public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs"); - public static final String DEFAULT_SESSION_FILE = "session"; - public static final String DEFAULT_CONFIG_FILE = "settings.properties"; + public static final File DEFAULT_SESSION_FILE = new File(RUNELITE_DIR, "session"); + public static final File DEFAULT_CONFIG_FILE = new File(RUNELITE_DIR, "settings.properties"); @Getter private static Injector injector; @@ -179,12 +179,14 @@ public class RuneLite parser.accepts("debug", "Show extra debugging output"); final ArgumentAcceptingOptionSpec sessionfile = parser.accepts("sessionfile", "Use a specified session file") - .withRequiredArg().defaultsTo(DEFAULT_SESSION_FILE) - .withValuesConvertedBy(new ConfigFileConverter()); + .withRequiredArg() + .withValuesConvertedBy(new ConfigFileConverter()) + .defaultsTo(DEFAULT_SESSION_FILE); final ArgumentAcceptingOptionSpec configfile = parser.accepts("config", "Use a specified config file") - .withRequiredArg().defaultsTo(DEFAULT_CONFIG_FILE) - .withValuesConvertedBy(new ConfigFileConverter()); + .withRequiredArg() + .withValuesConvertedBy(new ConfigFileConverter()) + .defaultsTo(DEFAULT_CONFIG_FILE); final ArgumentAcceptingOptionSpec updateMode = parser .accepts("rs", "Select client type") 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 6e7102920f..8bf579d115 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 @@ -142,7 +142,7 @@ public class ConfigManager else { File profileDir = new File(RuneLite.PROFILES_DIR, session.getUsername().toLowerCase()); - return new File(profileDir, RuneLite.DEFAULT_CONFIG_FILE); + return new File(profileDir, RuneLite.DEFAULT_CONFIG_FILE.getName()); } } @@ -335,7 +335,7 @@ public class ConfigManager parent.mkdirs(); - File tempFile = new File(parent, RuneLite.DEFAULT_CONFIG_FILE + ".tmp"); + File tempFile = new File(parent, RuneLite.DEFAULT_CONFIG_FILE.getName() + ".tmp"); try (FileOutputStream out = new FileOutputStream(tempFile)) { 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 d98fee4097..aae6194a3c 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 @@ -61,11 +61,11 @@ public class ConfigManagerTest @Bind @Named("sessionfile") - File sessionfile = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE); + File sessionfile = RuneLite.DEFAULT_SESSION_FILE; @Bind @Named("config") - File config = new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE); + File config = RuneLite.DEFAULT_CONFIG_FILE; @Inject ConfigManager manager; 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 8aaaa9ea86..929d83bbd4 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 @@ -84,8 +84,8 @@ public class PluginManagerTest { Injector injector = Guice.createInjector(Modules .override(new RuneLiteModule(() -> null, true, - new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE), - new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE))) + RuneLite.DEFAULT_SESSION_FILE, + RuneLite.DEFAULT_CONFIG_FILE)) .with(BoundFieldModule.of(this))); RuneLite.setInjector(injector); @@ -147,8 +147,8 @@ public class PluginManagerTest List modules = new ArrayList<>(); modules.add(new GraphvizModule()); modules.add(new RuneLiteModule(() -> null, true, - new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_SESSION_FILE), - new File(RuneLite.RUNELITE_DIR, RuneLite.DEFAULT_CONFIG_FILE))); + RuneLite.DEFAULT_SESSION_FILE, + RuneLite.DEFAULT_CONFIG_FILE)); PluginManager pluginManager = new PluginManager(true, null, null, null, null, null); pluginManager.loadCorePlugins(); From 31aa8ab26ca6b860f4f2a8120effab32abacd5d0 Mon Sep 17 00:00:00 2001 From: DeliciousLunch55 Date: Fri, 6 Mar 2020 13:28:28 -0600 Subject: [PATCH 19/28] BeginnerMapClue: Add Fairy Ring code to Wizard's Tower clue hint --- .../client/plugins/cluescrolls/clues/BeginnerMapClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java index caaeaeeb61..03947000ef 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java @@ -37,7 +37,7 @@ public class BeginnerMapClue extends MapClue implements LocationClueScroll new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_VARROCK_EAST_MINE, new WorldPoint(3290, 3374, 0), "Outside Varrock East Mine"), new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_DRAYNOR, new WorldPoint(3093, 3226, 0), "South of Draynor Village Bank"), new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_NORTH_OF_FALADOR, new WorldPoint(3043, 3398, 0), "In the standing stones north of Falador"), - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER, new WorldPoint(3110, 3152, 0), "On the south side of the Wizard's Tower") + new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER, new WorldPoint(3110, 3152, 0), "On the south side of the Wizard's Tower (DIS)") ); private final int widgetGroupID; From 4e66b8397af3075f3e29a4811837ae1616c50bc0 Mon Sep 17 00:00:00 2001 From: dekvall Date: Wed, 4 Mar 2020 00:11:42 +0100 Subject: [PATCH 20/28] widgetid: fix lms ingame info --- .../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 2d4e25ba0c..859ea90bda 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 @@ -874,7 +874,7 @@ public class WidgetID static class LmsKDA { - static final int INFO = 4; + static final int INFO = 5; } static class AdventureLog From 172b30dc420e0ae3645e6454dc647c929600e6c3 Mon Sep 17 00:00:00 2001 From: melkypie <5113962+melkypie@users.noreply.github.com> Date: Thu, 5 Mar 2020 18:17:20 +0200 Subject: [PATCH 21/28] scripts: use ScriptPostFired event for scripts that callback at the end of the script Uses the ScriptPostFired event that was added with the script inspector dev tool, removing the scripts that can be done with it. --- .../main/java/net/runelite/api/ScriptID.java | 24 + .../plugins/clanchat/ClanChatPlugin.java | 16 +- .../grandexchange/GrandExchangePlugin.java | 18 +- .../ItemsKeptOnDeathPlugin.java | 7 +- .../plugins/itemstats/ItemStatPlugin.java | 7 +- .../plugins/questlist/QuestListPlugin.java | 7 +- .../main/scripts/ClanChatChannelRebuild.hash | 1 - .../scripts/ClanChatChannelRebuild.rs2asm | 802 ------------------ .../src/main/scripts/DeathkeepBuild.hash | 1 - .../src/main/scripts/DeathkeepBuild.rs2asm | 634 -------------- .../src/main/scripts/GEOffersSetupInit.hash | 1 - .../src/main/scripts/GEOffersSetupInit.rs2asm | 394 --------- .../main/scripts/QuestListShowProgress.hash | 1 - .../main/scripts/QuestListShowProgress.rs2asm | 228 ----- 14 files changed, 58 insertions(+), 2083 deletions(-) delete mode 100644 runelite-client/src/main/scripts/ClanChatChannelRebuild.hash delete mode 100644 runelite-client/src/main/scripts/ClanChatChannelRebuild.rs2asm delete mode 100644 runelite-client/src/main/scripts/DeathkeepBuild.hash delete mode 100644 runelite-client/src/main/scripts/DeathkeepBuild.rs2asm delete mode 100644 runelite-client/src/main/scripts/GEOffersSetupInit.hash delete mode 100644 runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm delete mode 100644 runelite-client/src/main/scripts/QuestListShowProgress.hash delete mode 100644 runelite-client/src/main/scripts/QuestListShowProgress.rs2asm 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 2a4693a2c2..f65e240121 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -203,4 +203,28 @@ public final class ScriptID */ @ScriptArguments(string = 1) public static final int CLAN_SEND_KICK = 215; + + /** + * Builds the items kept on death widget + */ + @ScriptArguments(integer = 4, string = 2) + public static final int DEATH_KEEP_BUILD = 1601; + + /** + * Builds the widget that holds all of the players inside a clan chat + */ + @ScriptArguments(integer = 15) + public static final int CLAN_CHAT_CHANNEL_BUILD = 1658; + + /** + * Builds the widget for making an offer in Grand Exchange + */ + @ScriptArguments(integer = 15) + public static final int GE_OFFERS_SETUP_BUILD = 779; + + /** + * Builds the quest list inside the quest tab that shows each quest's progress + */ + @ScriptArguments(integer = 3) + public static final int QUESTLIST_PROGRESS_LIST_SHOW = 1354; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index e6c811a86c..1e51d1b4df 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -64,6 +64,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.PlayerDespawned; import net.runelite.api.events.PlayerSpawned; import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.VarClientStrChanged; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; @@ -554,12 +555,15 @@ public class ClanChatPlugin extends Plugin clientThread.invokeLater(() -> confirmKickPlayer(kickPlayerName)); break; } - case "clanChatChannelRebuild": - if (config.showIgnores()) - { - clientThread.invoke(() -> colorIgnoredPlayers(config.showIgnoresColor())); - } - break; + } + } + + @Subscribe + public void onScriptPostFired(ScriptPostFired event) + { + if (event.getScriptId() == ScriptID.CLAN_CHAT_CHANNEL_BUILD && config.showIgnores()) + { + colorIgnoredPlayers(config.showIgnoresColor()); } } 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 32ebd2b8a3..8dbe31bda5 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 @@ -48,12 +48,14 @@ import net.runelite.api.GrandExchangeOfferState; import net.runelite.api.ItemComposition; import net.runelite.api.MenuAction; import net.runelite.api.MenuEntry; +import net.runelite.api.ScriptID; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.FocusChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; @@ -435,14 +437,20 @@ public class GrandExchangePlugin extends Plugin } } + @Subscribe + public void onScriptPostFired(ScriptPostFired event) + { + // GE offers setup init + if (event.getScriptId() != ScriptID.GE_OFFERS_SETUP_BUILD) + { + return; + } + rebuildGeText(); + } + @Subscribe public void onScriptCallbackEvent(ScriptCallbackEvent event) { - if (event.getEventName().equals("geBuilt")) - { - rebuildGeText(); - } - if (!event.getEventName().equals("setGETitle") || !config.showTotal()) { return; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java index e8fc4b30d2..afd0fe6602 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java @@ -51,7 +51,7 @@ import net.runelite.api.SkullIcon; import net.runelite.api.SpriteID; import net.runelite.api.Varbits; import net.runelite.api.WorldType; -import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.vars.AccountType; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; @@ -72,6 +72,7 @@ import net.runelite.client.util.QuantityFormatter; public class ItemsKeptOnDeathPlugin extends Plugin { private static final int DEEP_WILDY = 20; + private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+).*"); @AllArgsConstructor @@ -121,9 +122,9 @@ public class ItemsKeptOnDeathPlugin extends Plugin int wildyLevel; @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent event) + public void onScriptPostFired(ScriptPostFired event) { - if (event.getEventName().equals("itemsKeptOnDeath")) + if (event.getScriptId() == ScriptID.DEATH_KEEP_BUILD) { // The script in charge of building the Items Kept on Death interface has finished running. // Make all necessary changes now. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index a74cb1f949..2ee90497df 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -41,12 +41,13 @@ import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; import net.runelite.api.ItemID; +import net.runelite.api.ScriptID; import net.runelite.api.SpriteID; import net.runelite.api.VarPlayer; import net.runelite.api.Varbits; import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.GameTick; -import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.VarbitChanged; import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.Widget; @@ -152,9 +153,9 @@ public class ItemStatPlugin extends Plugin } @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent event) + public void onScriptPostFired(ScriptPostFired event) { - if (event.getEventName().equals("geBuilt") && config.geStats()) + if (event.getScriptId() == ScriptID.GE_OFFERS_SETUP_BUILD && config.geStats()) { int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM); if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java index ecc2a80bf3..0ac160ac60 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java @@ -43,7 +43,7 @@ import net.runelite.api.SpriteID; import net.runelite.api.VarClientInt; import net.runelite.api.Varbits; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.events.VarClientIntChanged; import net.runelite.api.events.VarbitChanged; import net.runelite.api.widgets.JavaScriptCallback; @@ -119,13 +119,12 @@ public class QuestListPlugin extends Plugin } @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent event) + public void onScriptPostFired(ScriptPostFired event) { - if (!event.getEventName().equals("questProgressUpdated")) + if (event.getScriptId() != ScriptID.QUESTLIST_PROGRESS_LIST_SHOW) { return; } - addQuestButtons(); } diff --git a/runelite-client/src/main/scripts/ClanChatChannelRebuild.hash b/runelite-client/src/main/scripts/ClanChatChannelRebuild.hash deleted file mode 100644 index e9601457f1..0000000000 --- a/runelite-client/src/main/scripts/ClanChatChannelRebuild.hash +++ /dev/null @@ -1 +0,0 @@ -C70BDF62710D9FC0EB6707BD94FC0C4335B428DEDD1B52DD51776F811F32C9CF \ No newline at end of file diff --git a/runelite-client/src/main/scripts/ClanChatChannelRebuild.rs2asm b/runelite-client/src/main/scripts/ClanChatChannelRebuild.rs2asm deleted file mode 100644 index 0724ae0048..0000000000 --- a/runelite-client/src/main/scripts/ClanChatChannelRebuild.rs2asm +++ /dev/null @@ -1,802 +0,0 @@ -.id 1658 -.int_stack_count 15 -.string_stack_count 0 -.int_var_count 25 -.string_var_count 1 -; Callback "clanChatChannelRebuild" for whenever clan chat is done being built, used inside ClanChatPlugin for ignores - iload 3 - iconst 6 - iconst 7 - iconst 6 - sconst "Sort by rank" - iload 0 - iload 1 - iload 2 - iload 3 - iload 4 - iload 5 - iload 6 - iload 7 - iload 8 - iload 9 - iload 10 - iload 11 - iload 12 - iload 13 - iload 14 - invoke 1659 - iload 4 - iconst 2 - iconst 3 - iconst 2 - sconst "Sort by name" - iload 0 - iload 1 - iload 2 - iload 3 - iload 4 - iload 5 - iload 6 - iload 7 - iload 8 - iload 9 - iload 10 - iload 11 - iload 12 - iload 13 - iload 14 - invoke 1659 - iload 5 - iconst 8 - iconst 9 - iconst 9 - sconst "Sort by last world change" - iload 0 - iload 1 - iload 2 - iload 3 - iload 4 - iload 5 - iload 6 - iload 7 - iload 8 - iload 9 - iload 10 - iload 11 - iload 12 - iload 13 - iload 14 - invoke 1659 - iload 6 - iconst 4 - iconst 5 - iconst 4 - sconst "Sort by world" - iload 0 - iload 1 - iload 2 - iload 3 - iload 4 - iload 5 - iload 6 - iload 7 - iload 8 - iload 9 - iload 10 - iload 11 - iload 12 - iload 13 - iload 14 - invoke 1659 - iload 7 - iconst 0 - iconst 1 - iconst 0 - sconst "Legacy sort" - iload 0 - iload 1 - iload 2 - iload 3 - iload 4 - iload 5 - iload 6 - iload 7 - iload 8 - iload 9 - iload 10 - iload 11 - iload 12 - iload 13 - iload 14 - invoke 1659 - 3644 - get_varc_int 185 - switch - 1: LABEL109 - 2: LABEL112 - 3: LABEL115 - 4: LABEL184 - 5: LABEL212 - 6: LABEL118 - 7: LABEL148 - 8: LABEL178 - 9: LABEL181 - jump LABEL239 -LABEL109: - iconst 0 - 3645 - jump LABEL239 -LABEL112: - iconst 1 - 3646 - jump LABEL239 -LABEL115: - iconst 0 - 3646 - jump LABEL239 -LABEL118: - iconst 1 - 3657 - get_varc_int 206 - switch - 3: LABEL125 - 4: LABEL128 - 5: LABEL135 - 8: LABEL142 - 9: LABEL145 - iconst 1 - 3646 - jump LABEL147 -LABEL125: - iconst 0 - 3646 - jump LABEL147 -LABEL128: - iconst 1 - 3652 - iconst 1 - 3647 - iconst 1 - 3646 - jump LABEL147 -LABEL135: - iconst 1 - 3652 - iconst 0 - 3647 - iconst 1 - 3646 - jump LABEL147 -LABEL142: - iconst 1 - 3648 - jump LABEL147 -LABEL145: - iconst 0 - 3648 -LABEL147: - jump LABEL239 -LABEL148: - iconst 0 - 3657 - get_varc_int 206 - switch - 3: LABEL155 - 4: LABEL158 - 5: LABEL165 - 8: LABEL172 - 9: LABEL175 - iconst 1 - 3646 - jump LABEL177 -LABEL155: - iconst 0 - 3646 - jump LABEL177 -LABEL158: - iconst 1 - 3652 - iconst 1 - 3647 - iconst 1 - 3646 - jump LABEL177 -LABEL165: - iconst 1 - 3652 - iconst 0 - 3647 - iconst 1 - 3646 - jump LABEL177 -LABEL172: - iconst 1 - 3648 - jump LABEL177 -LABEL175: - iconst 0 - 3648 -LABEL177: - jump LABEL239 -LABEL178: - iconst 1 - 3648 - jump LABEL239 -LABEL181: - iconst 0 - 3648 - jump LABEL239 -LABEL184: - iconst 1 - 3652 - iconst 1 - 3647 - get_varc_int 206 - switch - 3: LABEL193 - 6: LABEL196 - 7: LABEL201 - 8: LABEL206 - 9: LABEL209 - iconst 1 - 3646 - jump LABEL211 -LABEL193: - iconst 0 - 3646 - jump LABEL211 -LABEL196: - iconst 1 - 3657 - iconst 1 - 3646 - jump LABEL211 -LABEL201: - iconst 0 - 3657 - iconst 1 - 3646 - jump LABEL211 -LABEL206: - iconst 1 - 3648 - jump LABEL211 -LABEL209: - iconst 0 - 3648 -LABEL211: - jump LABEL239 -LABEL212: - iconst 1 - 3652 - iconst 0 - 3647 - get_varc_int 206 - switch - 3: LABEL221 - 6: LABEL224 - 7: LABEL229 - 8: LABEL234 - 9: LABEL237 - iconst 1 - 3646 - jump LABEL239 -LABEL221: - iconst 0 - 3646 - jump LABEL239 -LABEL224: - iconst 1 - 3657 - iconst 1 - 3646 - jump LABEL239 -LABEL229: - iconst 0 - 3657 - iconst 1 - 3646 - jump LABEL239 -LABEL234: - iconst 1 - 3648 - jump LABEL239 -LABEL237: - iconst 0 - 3648 -LABEL239: - 3655 - iload 8 - cc_deleteall - clan_getchatcount - istore 15 - get_varbit 6363 - iconst 1 - if_icmpeq LABEL248 - jump LABEL296 -LABEL248: - iload 15 - iconst 0 - if_icmpgt LABEL252 - jump LABEL253 -LABEL252: - clan_leavechat -LABEL253: - iconst 0 - istore 15 - iconst 0 - iload 2 - if_sethide - iconst 1 - iload 9 - if_sethide - iload 11 - invoke 2067 - pop_int - iconst -1 - sconst "" - iload 11 - if_setonmouserepeat - iconst -1 - sconst "" - iload 11 - if_setonmouseleave - iload 13 - invoke 2067 - pop_int - iconst -1 - sconst "" - iload 13 - if_setonmouserepeat - iconst -1 - sconst "" - iload 13 - if_setonmouseleave - sconst "" - sconst "---" - sconst "" - join_string 3 - iload 12 - if_settext - iload 12 - if_clearops - iconst -1 - sconst "" - iload 12 - if_setonop - jump LABEL341 -LABEL296: - iconst 1 - iload 2 - if_sethide - iconst 0 - iload 9 - if_sethide - iload 11 - invoke 486 - pop_int - iconst 94 - iconst -2147483645 - sconst "I" - iload 11 - if_setonmouserepeat - iconst 92 - iconst -2147483645 - sconst "I" - iload 11 - if_setonmouseleave - iload 13 - invoke 486 - pop_int - iconst 94 - iconst -2147483645 - sconst "I" - iload 13 - if_setonmouserepeat - iconst 92 - iconst -2147483645 - sconst "I" - iload 13 - if_setonmouseleave - sconst "Clan Setup" - iload 12 - if_settext - iconst 1 - sconst "Clan Setup" - iload 12 - if_setop - iconst 489 - iconst -2147483644 - iconst 1 - sconst "ii" - iload 12 - if_setonop -LABEL341: - sconst "" - sstore 0 - iconst -1 - istore 16 - iconst -1 - istore 17 - clan_getchatrank - istore 18 - clan_getchatminkick - istore 19 - iload 3 - if_getwidth - istore 20 - iconst 0 - istore 21 - iconst 0 - istore 22 - iconst 15 - istore 23 - invoke 1972 - iconst 1 - if_icmpeq LABEL364 - jump LABEL369 -LABEL364: - iconst 8 - iconst 5 - iload 23 - scale - istore 23 -LABEL369: - iconst 0 - istore 24 -LABEL371: - iload 24 - iload 15 - if_icmplt LABEL375 - jump LABEL572 -LABEL375: - iload 24 - clan_getchatusername - iload 24 - clan_getchatuserworld - iload 24 - clan_getchatuserrank - istore 17 - istore 16 - sstore 0 - iload 8 - iconst 4 - iload 21 - cc_create - iload 21 - iconst 1 - add - istore 21 - iload 20 - iload 23 - iconst 1 - iconst 0 - cc_setsize - iconst 0 - iload 22 - iconst 2 - iconst 0 - cc_setposition - iconst 494 - cc_settextfont - iconst 0 - iconst 1 - iconst 0 - cc_settextalign - sload 0 - cc_settext - iconst 16777215 - cc_setcolour - iconst 0 - cc_settextshadow - iload 8 - iconst 4 - iload 21 - cc_create 1 - iload 21 - iconst 1 - add - istore 21 - iload 20 - iload 23 - iconst 1 - iconst 0 - cc_setsize 1 - iconst 0 - iload 22 - iconst 2 - iconst 0 - cc_setposition 1 - iconst 494 - cc_settextfont 1 - iconst 2 - iconst 1 - iconst 0 - cc_settextalign 1 - sconst "World " - iload 16 - tostring - join_string 2 - cc_settext 1 - iload 16 - map_world - if_icmpeq LABEL447 - jump LABEL450 -LABEL447: - iconst 901389 - cc_setcolour 1 - jump LABEL452 -LABEL450: - iconst 16777060 - cc_setcolour 1 -LABEL452: - iconst 0 - cc_settextshadow 1 - iload 8 - iconst 5 - iload 21 - cc_create 1 - iload 21 - iconst 1 - add - istore 21 - iconst 9 - iconst 9 - iconst 0 - iconst 0 - cc_setsize 1 - iconst 1 - iload 22 - iload 23 - iconst 9 - sub - iconst 2 - div - add - iconst 0 - iconst 0 - cc_setposition 1 - iconst 105 - iconst 100 - iconst 706 - iload 17 - enum - cc_setgraphic 1 - iload 24 - clan_isself - iconst 0 - if_icmpeq LABEL489 - jump LABEL525 -LABEL489: - iload 24 - clan_isfriend - iconst 1 - if_icmpeq LABEL494 - jump LABEL501 -LABEL494: - iconst 9 - sconst "Remove friend" - cc_setop - iconst 9 - sconst "Remove friend" - cc_setop 1 - jump LABEL525 -LABEL501: - iload 24 - clan_isignore - iconst 1 - if_icmpeq LABEL506 - jump LABEL513 -LABEL506: - iconst 10 - sconst "Remove ignore" - cc_setop - iconst 10 - sconst "Remove ignore" - cc_setop 1 - jump LABEL525 -LABEL513: - iconst 7 - sconst "Add friend" - cc_setop - iconst 7 - sconst "Add friend" - cc_setop 1 - iconst 8 - sconst "Add ignore" - cc_setop - iconst 8 - sconst "Add ignore" - cc_setop 1 -LABEL525: - invoke 1942 - iconst 0 - if_icmpeq LABEL529 - jump LABEL543 -LABEL529: - iload 18 - iload 19 - if_icmpge LABEL533 - jump LABEL543 -LABEL533: - iload 18 - iload 17 - if_icmpgt LABEL537 - jump LABEL543 -LABEL537: - iconst 6 - sconst "Kick user" - cc_setop - iconst 6 - sconst "Kick user" - cc_setop 1 -LABEL543: - sconst "" - sload 0 - sconst "" - join_string 3 - cc_setopbase - sconst "" - sload 0 - sconst "" - join_string 3 - cc_setopbase 1 - iconst 214 - sconst "event_opbase" - iconst -2147483644 - sconst "si" - cc_setonop - iconst 214 - sconst "event_opbase" - iconst -2147483644 - sconst "si" - cc_setonop 1 - iload 24 - iconst 1 - add - iload 22 - iload 23 - add - istore 22 - istore 24 - jump LABEL371 -LABEL572: - iload 15 - iconst 1 - if_icmpge LABEL576 - jump LABEL580 -LABEL576: - iload 22 - iconst 5 - add - istore 22 -LABEL580: - iload 10 - if_clearops - get_varbit 6363 - iconst 1 - if_icmpeq LABEL586 - jump LABEL605 -LABEL586: - sconst "" - iload 0 - if_settext - sconst "" - iload 1 - if_settext - sconst "" - sconst "---" - sconst "" - join_string 3 - iload 10 - if_settext - iload 10 - if_clearops - iconst -1 - sconst "" - iload 10 - if_setonop - jump LABEL672 -LABEL605: - iload 15 - iconst 0 - if_icmpgt LABEL609 - jump LABEL653 -LABEL609: - sconst "" - clan_getchatdisplayname - sconst "" - join_string 3 - iload 0 - if_settext - sconst "" - clan_getchatownername - sconst "" - join_string 3 - iload 1 - if_settext - sconst "Leave Chat" - iload 10 - if_settext - get_varbit 5432 - iconst 1 - if_icmpeq LABEL631 - get_varbit 4289 - iconst 0 - if_icmpne LABEL631 - jump LABEL642 -LABEL631: - iconst 6 - sconst "Leave Chat" - iload 10 - if_setop - iconst 194 - iconst -2147483644 - iconst 6 - sconst "ii" - iload 10 - if_setonop - jump LABEL652 -LABEL642: - iconst 1 - sconst "Leave Chat" - iload 10 - if_setop - iconst 194 - iconst -2147483644 - iconst 1 - sconst "ii" - iload 10 - if_setonop -LABEL652: - jump LABEL672 -LABEL653: - sconst "Not in chat" - iload 0 - if_settext - sconst "None" - iload 1 - if_settext - sconst "Join Chat" - iload 10 - if_settext - iconst 1 - sconst "Join Chat" - iload 10 - if_setop - iconst 194 - iconst -2147483644 - iconst 1 - sconst "ii" - iload 10 - if_setonop -LABEL672: - iload 22 - iload 8 - if_getheight - if_icmpgt LABEL677 - jump LABEL687 -LABEL677: - iconst 0 - iload 22 - iload 8 - if_setscrollsize - iload 9 - iload 8 - iload 8 - if_getscrolly - invoke 72 - jump LABEL695 -LABEL687: - iconst 0 - iconst 0 - iload 8 - if_setscrollsize - iload 9 - iload 8 - iconst 0 - invoke 72 -LABEL695: - sconst "clanChatChannelRebuild" - runelite_callback - return diff --git a/runelite-client/src/main/scripts/DeathkeepBuild.hash b/runelite-client/src/main/scripts/DeathkeepBuild.hash deleted file mode 100644 index 18f92dce5c..0000000000 --- a/runelite-client/src/main/scripts/DeathkeepBuild.hash +++ /dev/null @@ -1 +0,0 @@ -15F58F5939D9311F3D76FA2F0F3441B7B0DA1E8EAE23C654948095A7D51E07F0 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm b/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm deleted file mode 100644 index 75ade43db2..0000000000 --- a/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm +++ /dev/null @@ -1,634 +0,0 @@ -.id 1601 -.int_stack_count 4 -.string_stack_count 2 -.int_var_count 14 -.string_var_count 3 -; callback "itemsKeptOnDeath" -; Used by the ItemsKepthOnDeath plugin to edit the interface -; Put a rune pouch in your inventory and it shouldn't have a white outline -; in the Items kept on death screen - sload 1 - iconst 262167 - if_settext - iconst 0 - istore 4 - iconst 0 - istore 5 - iconst -1 - istore 6 - iconst 0 - istore 7 - sconst "" - sstore 2 - iconst 0 - istore 8 - iconst 0 - istore 9 - iconst 0 - istore 10 - iconst 0 - istore 11 - iload 1 - define_array 111 - iconst 0 - istore 12 - iconst 0 - istore 13 - iload 0 - iconst 0 - if_icmpeq LABEL31 - jump LABEL525 -LABEL31: - iconst 93 - iconst 13190 - inv_total - iconst 0 - if_icmpgt LABEL42 - iconst 93 - iconst 13192 - inv_total - iconst 0 - if_icmpgt LABEL42 - jump LABEL44 -LABEL42: - iconst 1 - istore 9 -LABEL44: - iload 10 - iload 1 - if_icmplt LABEL48 - jump LABEL88 -LABEL48: - iconst 584 - iload 11 - inv_getobj - istore 6 - iload 6 - iconst -1 - if_icmpne LABEL56 - jump LABEL85 -LABEL56: - iconst 584 - iload 11 - inv_getnum - istore 7 -LABEL60: - iload 10 - iload 1 - if_icmplt LABEL64 - jump LABEL80 -LABEL64: - iload 7 - iconst 0 - if_icmpgt LABEL68 - jump LABEL80 -LABEL68: - iload 10 - iload 6 - set_array_int - iload 7 - iconst 1 - sub - istore 7 - iload 10 - iconst 1 - add - istore 10 - jump LABEL60 -LABEL80: - iload 11 - iconst 1 - add - istore 11 - jump LABEL87 -LABEL85: - iload 1 - istore 10 -LABEL87: - jump LABEL44 -LABEL88: - iload 4 - iload 1 - if_icmplt LABEL92 - jump LABEL147 -LABEL92: - iconst 262162 - iconst 5 - iload 4 - cc_create - iconst 36 - iconst 32 - iconst 0 - iconst 0 - cc_setsize - iconst 5 - iload 4 - iconst 40 - multiply - add - iconst 25 - iconst 0 - iconst 0 - cc_setposition - iload 4 - get_array_int - istore 6 - iload 6 - iconst -1 - if_icmpne LABEL117 - jump LABEL144 -LABEL117: - iload 6 - iconst 1 - cc_setobject - sconst "" - iload 6 - oc_name - join_string 2 - cc_setopbase - iconst 1 - sconst "Item:" - cc_setop - iconst 1603 - iconst 1 - iconst 1 - iload 6 - oc_name - sconst "1is" - cc_setonop - iconst 1118481 - cc_setgraphicshadow - iconst 1 - cc_setoutline - iload 4 - iconst 1 - add - istore 4 - jump LABEL146 -LABEL144: - iload 1 - istore 4 -LABEL146: - jump LABEL88 -LABEL147: - iconst 0 - istore 4 -LABEL149: - iload 4 - iconst 468 - inv_size - if_icmplt LABEL154 - jump LABEL350 -LABEL154: - iconst 468 - iload 4 - inv_getobj - istore 6 - iload 6 - iconst -1 - if_icmpne LABEL162 - jump LABEL345 -LABEL162: - iconst 262165 - iconst 5 - iload 5 - cc_create - iconst 36 - iconst 32 - iconst 0 - iconst 0 - cc_setsize - iconst 5 - iload 5 - iconst 8 - mod - iconst 38 - multiply - add - iconst 25 - iconst 38 - iload 5 - iconst 8 - div - multiply - add - iconst 0 - iconst 0 - cc_setposition - iload 6 - iconst 468 - iload 4 - inv_getnum - cc_setobject - sconst "" - iload 6 - oc_name - join_string 2 - cc_setopbase - iconst 1 - sconst "Item:" - cc_setop - iconst 1603 - iconst 0 - iconst 468 - iload 4 - inv_getnum - iload 6 - oc_name - sconst "1is" - cc_setonop - iconst 1118481 - cc_setgraphicshadow - iconst 111 - iconst 49 - iconst 879 - iload 6 - oc_uncert - enum - iconst 1 - if_icmpeq LABEL221 - jump LABEL226 -LABEL221: - iconst 2 - cc_setoutline - iconst 1 - istore 8 - jump LABEL228 -LABEL226: - iconst 1 - cc_setoutline -LABEL228: - iload 5 - iconst 1 - add - istore 5 - iload 6 - oc_stackable - iconst 1 - if_icmpeq LABEL237 - jump LABEL345 -LABEL237: - iconst 0 - istore 10 - iconst 0 - istore 13 -LABEL241: - iload 10 - iload 1 - if_icmplt LABEL245 - jump LABEL259 -LABEL245: - iload 10 - get_array_int - iload 6 - if_icmpeq LABEL250 - jump LABEL254 -LABEL250: - iload 13 - iconst 1 - add - istore 13 -LABEL254: - iload 10 - iconst 1 - add - istore 10 - jump LABEL241 -LABEL259: - iconst 2147483647 - iconst 94 - iload 6 - inv_total - sub - iconst 93 - iload 6 - inv_total - sub - iload 13 - add - istore 12 - iconst 0 - iload 12 - sub - istore 12 - iload 12 - iconst 0 - if_icmpgt LABEL279 - jump LABEL345 -LABEL279: - iconst 262165 - iconst 5 - iload 5 - cc_create - iconst 36 - iconst 32 - iconst 0 - iconst 0 - cc_setsize - iconst 5 - iload 5 - iconst 8 - mod - iconst 38 - multiply - add - iconst 25 - iconst 38 - iload 5 - iconst 8 - div - multiply - add - iconst 0 - iconst 0 - cc_setposition - iload 6 - iload 12 - cc_setobject - sconst "" - iload 6 - oc_name - join_string 2 - cc_setopbase - iconst 1 - sconst "Item:" - cc_setop - iconst 1603 - iconst 0 - iload 12 - iload 6 - oc_name - sconst "1is" - cc_setonop - iconst 1118481 - cc_setgraphicshadow - iconst 111 - iconst 49 - iconst 879 - iload 6 - oc_uncert - enum - iconst 1 - if_icmpeq LABEL334 - jump LABEL339 -LABEL334: - iconst 2 - cc_setoutline - iconst 1 - istore 8 - jump LABEL341 -LABEL339: - iconst 1 - cc_setoutline -LABEL341: - iload 5 - iconst 1 - add - istore 5 -LABEL345: - iload 4 - iconst 1 - add - istore 4 - jump LABEL149 -LABEL350: - sconst "The normal amount of items kept is " - sconst "three" - sconst "." - sconst "
" - sconst "
" - join_string 5 - sstore 2 - iload 3 - iconst 1 - if_icmpeq LABEL361 - jump LABEL371 -LABEL361: - sload 2 - sconst "You're an " - sconst "" - sconst "Ultimate Iron Man" - sconst "" - sconst ", so you will always keep zero items." - join_string 5 - append - sstore 2 - jump LABEL434 -LABEL371: - iload 1 - iconst 0 - if_icmpeq LABEL375 - jump LABEL387 -LABEL375: - sload 2 - sconst "You're marked with a " - sconst "" - sconst "PK skull" - sconst "" - sconst ". This reduces the items you keep from " - sconst "three" - sconst " to zero!" - join_string 7 - append - sstore 2 - jump LABEL434 -LABEL387: - iload 1 - iconst 1 - if_icmpeq LABEL391 - jump LABEL410 -LABEL391: - sload 2 - sconst "You're marked with a " - sconst "" - sconst "PK skull" - sconst "" - sconst ". This reduces the items you keep from " - sconst "three" - sconst " to zero!" - sconst "
" - sconst "
" - sconst "However, you also have the " - sconst "" - sconst "Protect Items" - sconst "" - sconst " prayer active, which saves you one extra item!" - join_string 14 - append - sstore 2 - jump LABEL434 -LABEL410: - iload 1 - iconst 3 - if_icmpeq LABEL414 - jump LABEL419 -LABEL414: - sload 2 - sconst "You have no factors affecting the items you keep." - append - sstore 2 - jump LABEL434 -LABEL419: - iload 1 - iconst 3 - iconst 1 - add - if_icmpeq LABEL425 - jump LABEL434 -LABEL425: - sload 2 - sconst "You have the " - sconst "" - sconst "Protect Items" - sconst "" - sconst " prayer active, which saves you one extra item!" - join_string 5 - append - sstore 2 -LABEL434: - iload 8 - iconst 1 - if_icmpeq LABEL441 - iload 9 - iconst 1 - if_icmpeq LABEL441 - jump LABEL492 -LABEL441: - iload 8 - iconst 1 - if_icmpeq LABEL445 - jump LABEL466 -LABEL445: - iload 9 - iconst 1 - if_icmpeq LABEL449 - jump LABEL466 -LABEL449: - sload 2 - sconst "
" - sconst "
" - sconst "Items with a " - sconst "" - sconst "white outline" - sconst "" - sconst " will always be lost." - sconst "
" - sconst "" - sconst "Bonds" - sconst "" - sconst " are always protected." - join_string 12 - append - sstore 2 - jump LABEL492 -LABEL466: - iload 8 - iconst 1 - if_icmpeq LABEL470 - jump LABEL482 -LABEL470: - sload 2 - sconst "
" - sconst "
" - sconst "Items with a " - sconst "" - sconst "white outline" - sconst "" - sconst " will always be lost." - join_string 7 - append - sstore 2 - jump LABEL492 -LABEL482: - sload 2 - sconst "
" - sconst "
" - sconst "" - sconst "Bonds" - sconst "" - sconst " are always protected, so are not shown here." - join_string 6 - append - sstore 2 -LABEL492: - sload 2 - iconst 262173 - if_settext - sconst "" - sconst "Max items kept on death :" - sconst "
" - sconst "
" - sconst "" - sconst "~ " - iload 1 - tostring - sconst " ~" - join_string 8 - iconst 262174 - if_settext - iload 2 - iconst 0 - if_icmpgt LABEL511 - jump LABEL518 -LABEL511: - sconst "Items you will keep on death:" - iconst 262161 - if_settext - sconst "Items you will lose on death:" - iconst 262164 - if_settext - jump LABEL524 -LABEL518: - sconst "Items you will keep on death if not skulled:" - iconst 262161 - if_settext - sconst "Items you will lose on death if not skulled:" - iconst 262164 - if_settext -LABEL524: - jump LABEL565 -LABEL525: - iconst 1 - iconst 262165 - if_sethide - iconst 1 - iconst 262162 - if_sethide - iconst 0 - iconst 262175 - if_sethide - sload 0 - iconst 262176 - if_settext - sconst "The normal amount of items kept is " - sconst "three" - sconst "." - sconst "
" - sconst "
" - join_string 5 - sstore 2 - sload 2 - sconst "You're in a " - sconst "" - sconst "safe area" - sconst "" - sconst ". See information to the left for a more detailed description." - join_string 5 - append - sstore 2 - sload 2 - iconst 262173 - if_settext - sconst "" - sconst "Max items kept on death :" - sconst "
" - sconst "
" - sconst "" - sconst "All items!" - join_string 6 - iconst 262174 - if_settext -LABEL565: - sconst "itemsKeptOnDeath" ; push event name - runelite_callback ; invoke callback - return diff --git a/runelite-client/src/main/scripts/GEOffersSetupInit.hash b/runelite-client/src/main/scripts/GEOffersSetupInit.hash deleted file mode 100644 index 689d72d678..0000000000 --- a/runelite-client/src/main/scripts/GEOffersSetupInit.hash +++ /dev/null @@ -1 +0,0 @@ -B370DDEEF61E0F420C1990DDA4FBBEDCEE8324F3750ABAC79B072A27268D887B \ No newline at end of file diff --git a/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm b/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm deleted file mode 100644 index e884731804..0000000000 --- a/runelite-client/src/main/scripts/GEOffersSetupInit.rs2asm +++ /dev/null @@ -1,394 +0,0 @@ -.id 779 -.int_stack_count 15 -.string_stack_count 0 -.int_var_count 16 -.string_var_count 1 - get_varbit 4397 - iconst 1 - if_icmpeq LABEL4 - jump LABEL65 -LABEL4: - iload 0 - iload 1 - cc_find - iconst 1 - if_icmpeq LABEL10 - jump LABEL12 -LABEL10: - iconst 1 - cc_sethide -LABEL12: - iload 0 - iload 6 - cc_find - iconst 1 - if_icmpeq LABEL18 - jump LABEL23 -LABEL18: - iconst 0 - cc_settrans - iconst -1 - sconst "" - cc_setontimer -LABEL23: - iload 0 - iload 12 - cc_find - iconst 1 - if_icmpeq LABEL29 - jump LABEL31 -LABEL29: - iconst 1 - cc_sethide -LABEL31: - iload 0 - iload 4 - cc_find - iconst 1 - if_icmpeq LABEL37 - jump LABEL39 -LABEL37: - sconst "Sell offer" - cc_settext -LABEL39: - iload 0 - iload 5 - cc_find - iconst 1 - if_icmpeq LABEL45 - jump LABEL47 -LABEL45: - iconst 1119 - cc_setgraphic -LABEL47: - iload 0 - iload 2 - cc_find - iconst 1 - if_icmpeq LABEL53 - jump LABEL56 -LABEL53: - iconst 1 - sconst "All" - cc_setop -LABEL56: - iload 0 - iload 3 - cc_find - iconst 1 - if_icmpeq LABEL62 - jump LABEL64 -LABEL62: - sconst "All" - cc_settext -LABEL64: - jump LABEL130 -LABEL65: - iload 0 - iload 1 - cc_find - iconst 1 - if_icmpeq LABEL71 - jump LABEL73 -LABEL71: - iconst 0 - cc_sethide -LABEL73: - iload 0 - iload 6 - cc_find - iconst 1 - if_icmpeq LABEL79 - jump LABEL89 -LABEL79: - iconst 100 - cc_settrans - iconst 811 - iconst -2147483645 - iconst -2147483643 - clientclock - iconst 100 - iconst 250 - sconst "Iiiii" - cc_setontimer -LABEL89: - iload 0 - iload 12 - cc_find - iconst 1 - if_icmpeq LABEL95 - jump LABEL97 -LABEL95: - iconst 0 - cc_sethide -LABEL97: - iload 0 - iload 4 - cc_find - iconst 1 - if_icmpeq LABEL103 - jump LABEL105 -LABEL103: - sconst "Buy offer" - cc_settext -LABEL105: - iload 0 - iload 5 - cc_find - iconst 1 - if_icmpeq LABEL111 - jump LABEL113 -LABEL111: - iconst 1118 - cc_setgraphic -LABEL113: - iload 0 - iload 2 - cc_find - iconst 1 - if_icmpeq LABEL119 - jump LABEL122 -LABEL119: - iconst 1 - sconst "+1K" - cc_setop -LABEL122: - iload 0 - iload 3 - cc_find - iconst 1 - if_icmpeq LABEL128 - jump LABEL130 -LABEL128: - sconst "+1K" - cc_settext -LABEL130: - sconst "," - sstore 0 - iconst 0 - istore 15 - get_varp 1151 - iconst -1 - if_icmpne LABEL138 - jump LABEL274 -LABEL138: - iload 0 - iload 7 - cc_find - iconst 1 - if_icmpeq LABEL144 - jump LABEL147 -LABEL144: - get_varp 1151 - get_varbit 4396 - cc_setobject_nonum -LABEL147: - iload 0 - iload 8 - cc_find - iconst 1 - if_icmpeq LABEL153 - jump LABEL156 -LABEL153: - get_varp 1151 - oc_name - cc_settext -LABEL156: - iload 0 - iload 9 - cc_find - iconst 1 - if_icmpeq LABEL162 - jump LABEL166 -LABEL162: - get_varbit 4396 - sload 0 - invoke 46 - cc_settext -LABEL166: - iload 0 - iload 10 - cc_find - iconst 1 - if_icmpeq LABEL172 - jump LABEL185 -LABEL172: - get_varbit 4398 - iconst 1 - if_icmpeq LABEL176 - jump LABEL179 -LABEL176: - sconst "1 coin" - cc_settext - jump LABEL185 -LABEL179: - get_varbit 4398 - sload 0 - invoke 46 - sconst " coins" - join_string 2 - cc_settext -LABEL185: - get_varbit 4396 - iconst 0 - if_icmpgt LABEL189 - jump LABEL211 -LABEL189: - iconst 2147483647 - get_varbit 4396 - div - get_varbit 4398 - if_icmplt LABEL195 - jump LABEL211 -LABEL195: - iload 0 - iload 11 - cc_find - iconst 1 - if_icmpeq LABEL201 - jump LABEL206 -LABEL201: - sconst "" - sconst "Too much money!" - sconst "" - join_string 3 - cc_settext -LABEL206: - iload 0 - iload 14 - iload 13 - invoke 780 - jump LABEL273 -LABEL211: - get_varbit 4396 - get_varbit 4398 - multiply - istore 15 - iload 0 - iload 11 - cc_find - iconst 1 - if_icmpeq LABEL221 - jump LABEL234 -LABEL221: - iload 15 - iconst 1 - if_icmpeq LABEL225 - jump LABEL228 -LABEL225: - sconst "1 coin" - cc_settext - jump LABEL234 -LABEL228: - iload 15 - sload 0 - invoke 46 - sconst " coins" - join_string 2 - cc_settext -LABEL234: - iload 15 - iconst 0 - if_icmpgt LABEL238 - jump LABEL269 -LABEL238: - iload 13 - invoke 208 - pop_int - iconst 772 - iconst -2147483645 - sconst "I" - iload 13 - if_setonmouserepeat - iconst 97 - iconst -2147483645 - sconst "I" - iload 13 - if_setonmouseleave - iconst 489 - iconst -2147483644 - iconst 2 - sconst "ii" - iload 13 - if_setonop - iload 0 - iload 14 - cc_find - iconst 1 - if_icmpeq LABEL263 - jump LABEL268 -LABEL263: - sconst "" - sconst "Confirm" - sconst "" - join_string 3 - cc_settext -LABEL268: - jump LABEL273 -LABEL269: - iload 0 - iload 14 - iload 13 - invoke 780 -LABEL273: - jump LABEL319 -LABEL274: - iload 0 - iload 7 - cc_find - iconst 1 - if_icmpeq LABEL280 - jump LABEL283 -LABEL280: - iconst 6512 - iconst 1 - cc_setobject_nonum -LABEL283: - iload 0 - iload 8 - cc_find - iconst 1 - if_icmpeq LABEL289 - jump LABEL291 -LABEL289: - sconst "Choose an item..." - cc_settext -LABEL291: - iload 0 - iload 9 - cc_find - iconst 1 - if_icmpeq LABEL297 - jump LABEL299 -LABEL297: - sconst "" - cc_settext -LABEL299: - iload 0 - iload 10 - cc_find - iconst 1 - if_icmpeq LABEL305 - jump LABEL307 -LABEL305: - sconst "" - cc_settext -LABEL307: - iload 0 - iload 11 - cc_find - iconst 1 - if_icmpeq LABEL313 - jump LABEL315 -LABEL313: - sconst "" - cc_settext -LABEL315: - iload 0 - iload 14 - iload 13 - invoke 780 -LABEL319: - sconst "geBuilt" ; - runelite_callback ; - return diff --git a/runelite-client/src/main/scripts/QuestListShowProgress.hash b/runelite-client/src/main/scripts/QuestListShowProgress.hash deleted file mode 100644 index c235a4ae9b..0000000000 --- a/runelite-client/src/main/scripts/QuestListShowProgress.hash +++ /dev/null @@ -1 +0,0 @@ -FC7F8B54745582D6DD530D5458E129B67D6B3CFF61BACD4BBE7BC8C40E26F3C6 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/QuestListShowProgress.rs2asm b/runelite-client/src/main/scripts/QuestListShowProgress.rs2asm deleted file mode 100644 index ca43ff61b9..0000000000 --- a/runelite-client/src/main/scripts/QuestListShowProgress.rs2asm +++ /dev/null @@ -1,228 +0,0 @@ -.id 1354 -.int_stack_count 3 -.string_stack_count 0 -.int_var_count 7 -.string_var_count 0 - iconst 0 - istore 3 - iconst 0 - istore 4 - iconst 0 - istore 5 - invoke 1340 - istore 6 -LABEL8: - iload 5 - iload 6 - if_icmplt LABEL12 - jump LABEL64 -LABEL12: - iload 0 - iload 5 - cc_find - iconst 1 - if_icmpeq LABEL18 - jump LABEL59 -LABEL18: - iload 5 - invoke 1357 - istore 3 - iload 5 - invoke 3236 - iconst 1 - if_icmpeq LABEL26 - jump LABEL29 -LABEL26: - iconst 10461087 - istore 4 - jump LABEL45 -LABEL29: - iload 3 - iconst 2 - if_icmpeq LABEL33 - jump LABEL36 -LABEL33: - iconst 901389 - istore 4 - jump LABEL45 -LABEL36: - iload 3 - iconst 0 - if_icmpeq LABEL40 - jump LABEL43 -LABEL40: - iconst 16776960 - istore 4 - jump LABEL45 -LABEL43: - iconst 16711680 - istore 4 -LABEL45: - iload 4 - cc_setcolour - iconst 85 - iconst -2147483645 - iconst -2147483643 - iconst 16777215 - sconst "Iii" - cc_setonmouseover - iconst 85 - iconst -2147483645 - iconst -2147483643 - iload 4 - sconst "Iii" - cc_setonmouseleave -LABEL59: - iload 5 - iconst 1 - add - istore 5 - jump LABEL8 -LABEL64: - iconst 0 - invoke 2245 - istore 6 - istore 5 -LABEL68: - iload 5 - iload 6 - if_icmplt LABEL72 - jump LABEL124 -LABEL72: - iload 1 - iload 5 - cc_find - iconst 1 - if_icmpeq LABEL78 - jump LABEL119 -LABEL78: - iload 5 - invoke 1358 - istore 3 - iload 5 - invoke 3237 - iconst 1 - if_icmpeq LABEL86 - jump LABEL89 -LABEL86: - iconst 10461087 - istore 4 - jump LABEL105 -LABEL89: - iload 3 - iconst 2 - if_icmpeq LABEL93 - jump LABEL96 -LABEL93: - iconst 901389 - istore 4 - jump LABEL105 -LABEL96: - iload 3 - iconst 0 - if_icmpeq LABEL100 - jump LABEL103 -LABEL100: - iconst 16776960 - istore 4 - jump LABEL105 -LABEL103: - iconst 16711680 - istore 4 -LABEL105: - iload 4 - cc_setcolour - iconst 85 - iconst -2147483645 - iconst -2147483643 - iconst 16777215 - sconst "Iii" - cc_setonmouseover - iconst 85 - iconst -2147483645 - iconst -2147483643 - iload 4 - sconst "Iii" - cc_setonmouseleave -LABEL119: - iload 5 - iconst 1 - add - istore 5 - jump LABEL68 -LABEL124: - iconst 0 - invoke 2265 - istore 6 - istore 5 -LABEL128: - iload 5 - iload 6 - if_icmplt LABEL132 - jump LABEL184 -LABEL132: - iload 2 - iload 5 - cc_find - iconst 1 - if_icmpeq LABEL138 - jump LABEL179 -LABEL138: - iload 5 - invoke 1359 - istore 3 - iload 5 - invoke 3238 - iconst 1 - if_icmpeq LABEL146 - jump LABEL149 -LABEL146: - iconst 10461087 - istore 4 - jump LABEL165 -LABEL149: - iload 3 - iconst 2 - if_icmpeq LABEL153 - jump LABEL156 -LABEL153: - iconst 901389 - istore 4 - jump LABEL165 -LABEL156: - iload 3 - iconst 0 - if_icmpeq LABEL160 - jump LABEL163 -LABEL160: - iconst 16776960 - istore 4 - jump LABEL165 -LABEL163: - iconst 16711680 - istore 4 -LABEL165: - iload 4 - cc_setcolour - iconst 85 - iconst -2147483645 - iconst -2147483643 - iconst 16777215 - sconst "Iii" - cc_setonmouseover - iconst 85 - iconst -2147483645 - iconst -2147483643 - iload 4 - sconst "Iii" - cc_setonmouseleave -LABEL179: - iload 5 - iconst 1 - add - istore 5 - jump LABEL128 -LABEL184: - sconst "questProgressUpdated" - runelite_callback - return From 65121f2704b86a27e0116cdde090ab48028d8e9f Mon Sep 17 00:00:00 2001 From: Ron Young Date: Tue, 20 Aug 2019 20:45:35 -0500 Subject: [PATCH 22/28] runelite-api: expose item model information --- .../net/runelite/api/ItemComposition.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 48135c07a3..16d7876c67 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemComposition.java @@ -24,6 +24,8 @@ */ package net.runelite.api; +import javax.annotation.Nullable; + /** * Represents the template of a specific item type. */ @@ -138,4 +140,29 @@ public interface ItemComposition * default value. */ void resetShiftClickActionIndex(); + + /** + * Gets the model ID of the inventory item. + * + * @return the model ID + */ + int getInventoryModel(); + + /** + * Since the client reuses item models, it stores colors that can be replaced. + * This returns what colors the item model will be replaced with. + * + * @return the colors to replace with + */ + @Nullable + short[] getColorToReplaceWith(); + + /** + * Since the client reuses item models, it stores textures that can be replaced. + * This returns what textures the item model will be replaced with. + * + * @return the textures to replace with + */ + @Nullable + short[] getTextureToReplaceWith(); } From 0db9fb97e9f97979d257fbed0f1cec0d47254360 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Tue, 20 Aug 2019 20:46:18 -0500 Subject: [PATCH 23/28] ChatboxItemSearch: check for duplicate item images --- .../game/chatbox/ChatboxItemSearch.java | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxItemSearch.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxItemSearch.java index 906e338b55..3796b8f2c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxItemSearch.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxItemSearch.java @@ -28,11 +28,14 @@ package net.runelite.client.game.chatbox; import com.google.common.primitives.Ints; import com.google.inject.Inject; import java.awt.event.KeyEvent; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import java.util.function.Consumer; import javax.inject.Singleton; import lombok.Getter; +import lombok.Value; import net.runelite.api.Client; import net.runelite.api.ItemComposition; import net.runelite.api.widgets.ItemQuantityMode; @@ -66,6 +69,14 @@ public class ChatboxItemSearch extends ChatboxTextInput @Getter private Consumer onItemSelected; + @Value + private static class ItemIcon + { + private final int modelId; + private final short[] colorsToReplace; + private final short[] texturesToReplace; + } + @Inject private ChatboxItemSearch(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread, ItemManager itemManager, Client client) @@ -287,15 +298,26 @@ public class ChatboxItemSearch extends ChatboxTextInput return; } + Set itemIcons = new HashSet<>(); for (int i = 0; i < client.getItemCount() && results.size() < MAX_RESULTS; i++) { ItemComposition itemComposition = itemManager.getItemComposition(itemManager.canonicalize(i)); String name = itemComposition.getName().toLowerCase(); + // The client assigns "null" to item names of items it doesn't know about - if (!name.equals("null") && name.contains(search)) + // and the item might already be in the results from canonicalize + if (!name.equals("null") && name.contains(search) && !results.containsKey(itemComposition.getId())) { - // This may already be in the map due to canonicalize mapping the item to something we've already seen - results.putIfAbsent(itemComposition.getId(), itemComposition); + // Check if the results already contain the same item image + ItemIcon itemIcon = new ItemIcon(itemComposition.getInventoryModel(), + itemComposition.getColorToReplaceWith(), itemComposition.getTextureToReplaceWith()); + if (itemIcons.contains(itemIcon)) + { + continue; + } + + itemIcons.add(itemIcon); + results.put(itemComposition.getId(), itemComposition); } } } From abaf45092b9f20d1068698da3ed726db6b35bce2 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 6 Mar 2020 15:19:53 -0500 Subject: [PATCH 24/28] interface styles: only adjust widget positions when tli is resized --- .../src/main/java/net/runelite/api/ScriptID.java | 6 ++++++ .../interfacestyles/InterfaceStylesPlugin.java | 12 ++++++++---- 2 files changed, 14 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 f65e240121..1fb85b0145 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -227,4 +227,10 @@ public final class ScriptID */ @ScriptArguments(integer = 3) public static final int QUESTLIST_PROGRESS_LIST_SHOW = 1354; + + /** + * Procedure called when the toplevel interface is resized + */ + @ScriptArguments(integer = 2) + public static final int TOPLEVEL_RESIZE = 909; } 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 c54bb0a7fa..bb22274aa0 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 @@ -33,19 +33,20 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.HealthBar; +import net.runelite.api.ScriptID; import net.runelite.api.SpriteID; import net.runelite.api.SpritePixels; import net.runelite.api.events.BeforeMenuRender; -import net.runelite.api.events.ClientTick; -import net.runelite.client.events.ConfigChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.PostHealthBar; import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.events.ScriptPostFired; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; 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.SpriteManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -119,9 +120,12 @@ public class InterfaceStylesPlugin extends Plugin } @Subscribe - public void onClientTick(ClientTick event) + public void onScriptPostFired(ScriptPostFired scriptPostFired) { - adjustWidgetDimensions(); + if (scriptPostFired.getScriptId() == ScriptID.TOPLEVEL_RESIZE) + { + adjustWidgetDimensions(); + } } @Subscribe From 26a84c34dd24d3d907e621c8f2967db1a7546d08 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 5 Mar 2020 21:22:26 +0000 Subject: [PATCH 25/28] api: fix venom hitsplat sprite id --- runelite-api/src/main/java/net/runelite/api/SpriteID.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8e4373ba71..0d81f168c4 100644 --- a/runelite-api/src/main/java/net/runelite/api/SpriteID.java +++ b/runelite-api/src/main/java/net/runelite/api/SpriteID.java @@ -1293,7 +1293,7 @@ public final class SpriteID public static final int SPELL_REANIMATE_CROPS_DISABLED = 1327; /* Unmapped: 1328~1337 */ public static final int WORLD_SWITCHER_WORLD_STAR_BLUE = 1338; - public static final int GAMEBLAST16_PROMO_BANNER = 1339; + public static final int HITSPLAT_DARK_GREEN_VENOM = 1339; public static final int FAIRY_RING_REMOVE_FAVOURITE = 1340; public static final int FAIRY_RING_ADD_FAVOURITE = 1341; public static final int BANK_PLACEHOLDERS_LOCK = 1342; @@ -1317,7 +1317,7 @@ public final class SpriteID public static final int HITSPLAT_GREEN_POISON = 1360; public static final int HITSPLAT_ORANGE = 1361; public static final int HITSPLAT_ORANGE_DISEASE = 1362; - public static final int HITSPLAT_DARK_GREEN_VENOM = 1363; + public static final int HITSPLAT_GREY = 1363; public static final int BOUNTY_HUNTER_SKIP_TARGET = 1364; public static final int BOUNTY_HUNTER_SKIP_TARGET_HOVERED = 1365; public static final int HOUSE_VIEWER_ROTATE_CLOCKWISE = 1366; From 92c588c348290b95220ac59be83c9a9e6f32e036 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 6 Mar 2020 16:04:23 -0500 Subject: [PATCH 26/28] ui: correct cursor hotspot to 0,0 This has never been correct, but worked because the container is always in the client frame at 0,0 --- .../src/main/java/net/runelite/client/ui/ClientUI.java | 2 +- 1 file changed, 1 insertion(+), 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 13595170b2..2ae6cc56c2 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 @@ -609,7 +609,7 @@ public class ClientUI return; } - final java.awt.Point hotspot = new java.awt.Point(container.getX(), container.getY()); + final java.awt.Point hotspot = new java.awt.Point(0, 0); final Cursor cursorAwt = Toolkit.getDefaultToolkit().createCustomCursor(image, hotspot, name); container.setCursor(cursorAwt); } From a34d9d30d66a0ca1361521b63970fb21752a6ac0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 8 Mar 2020 18:01:23 -0400 Subject: [PATCH 27/28] Reset Discord status after a while of being in menu (#9116) Closes #667 --- .../client/discord/DiscordPresence.java | 2 +- .../client/plugins/discord/DiscordState.java | 23 ++++- .../plugins/discord/DiscordStateTest.java | 91 +++++++++++++++++++ 3 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/discord/DiscordPresence.java b/runelite-client/src/main/java/net/runelite/client/discord/DiscordPresence.java index fd444e8929..66bb52fb5d 100644 --- a/runelite-client/src/main/java/net/runelite/client/discord/DiscordPresence.java +++ b/runelite-client/src/main/java/net/runelite/client/discord/DiscordPresence.java @@ -31,7 +31,7 @@ import lombok.Value; /** * Represents Discord Rich Presence RPC data */ -@Builder +@Builder(toBuilder = true) @Value public class DiscordPresence { 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 3361b26c52..6950200606 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 @@ -122,9 +122,7 @@ class DiscordState } else { - // If we aren't showing the elapsed time within Discord then - // We null out the event start property - event = new EventWithTime(eventType, config.hideElapsedTime() ? null : Instant.now()); + event = new EventWithTime(eventType, Instant.now()); events.add(event); } @@ -177,7 +175,7 @@ class DiscordState .state(MoreObjects.firstNonNull(state, "")) .details(MoreObjects.firstNonNull(details, "")) .largeImageText(RuneLiteProperties.getTitle() + " v" + versionShortHand) - .startTimestamp(event.getStart()) + .startTimestamp(config.hideElapsedTime() ? null : event.getStart()) .smallImageKey(imageKey) .partyMax(PARTY_MAX) .partySize(party.getMembers().size()); @@ -203,8 +201,25 @@ class DiscordState */ void checkForTimeout() { + if (events.isEmpty()) + { + return; + } + final Duration actionTimeout = Duration.ofMinutes(config.actionTimeout()); final Instant now = Instant.now(); + final EventWithTime eventWithTime = events.get(0); + events.removeIf(event -> event.getType().isShouldTimeout() && now.isAfter(event.getUpdated().plus(actionTimeout))); + + if (eventWithTime.getType().getState().equals(DiscordGameEventType.IN_MENU.getState()) && now.isAfter(eventWithTime.getStart().plus(actionTimeout))) + { + final DiscordPresence presence = lastPresence + .toBuilder() + .startTimestamp(null) + .build(); + lastPresence = presence; + discordService.updatePresence(presence); + } } } 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 new file mode 100644 index 0000000000..9cfcb1fbbb --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/discord/DiscordStateTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2018, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.discord; + +import com.google.inject.Guice; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import java.util.List; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.client.discord.DiscordPresence; +import net.runelite.client.discord.DiscordService; +import net.runelite.client.ws.PartyService; +import static org.junit.Assert.assertNull; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import static org.mockito.ArgumentMatchers.any; +import org.mockito.Mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class DiscordStateTest +{ + @Inject + DiscordState discordState; + + @Mock + @Bind + DiscordConfig discordConfig; + + @Mock + @Bind + DiscordService discordService; + + @Mock + @Bind + Client client; + + @Mock + @Bind + PartyService partyService; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + } + + @Test + public void testStatusTimeout() + { + when(discordConfig.actionTimeout()).thenReturn(0); + when(discordConfig.hideElapsedTime()).thenReturn(false); + + discordState.triggerEvent(DiscordGameEventType.IN_MENU); + verify(discordService).updatePresence(any(DiscordPresence.class)); + + discordState.checkForTimeout(); + ArgumentCaptor captor = ArgumentCaptor.forClass(DiscordPresence.class); + verify(discordService, times(2)).updatePresence(captor.capture()); + List captured = captor.getAllValues(); + assertNull(captured.get(captured.size() - 1).getEndTimestamp()); + } +} From 480a5ab921942598c2aca45e49994ef9a744c1a8 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 9 Mar 2020 01:28:29 -0600 Subject: [PATCH 28/28] music: correctly recreate volume widgets after relogs --- .../java/net/runelite/client/plugins/music/MusicPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 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 812eb86959..f6e78ef4b5 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 @@ -452,7 +452,9 @@ public class MusicPlugin extends Plugin for (MusicSlider slider : MusicSlider.values()) { Widget icon = client.getWidget(slider.getWidgetID()); - if (icon == null) + // 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; }