From ff6e12a542f9bd9998fb0b4ea2c3acc2467095cd Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Tue, 20 Jul 2021 13:13:51 +0100 Subject: [PATCH 01/32] client: update various wordings to use "signed in/out" for RL accounts --- .../java/net/runelite/client/account/SessionManager.java | 4 ++-- .../runelite/client/plugins/account/AccountPlugin.java | 6 +++--- .../java/net/runelite/client/plugins/info/InfoPanel.java | 8 ++++---- .../client/plugins/loottracker/LootTrackerConfig.java | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) 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 4b6bf1674e..93c1f8f584 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 @@ -186,7 +186,7 @@ public class SessionManager } catch (IOException ex) { - log.warn("Unable to logout of session", ex); + log.warn("Unable to sign out of session", ex); } accountSession = null; // No more account @@ -225,7 +225,7 @@ public class SessionManager @Subscribe public void onLoginResponse(LoginResponse loginResponse) { - log.debug("Now logged in as {}", loginResponse.getUsername()); + log.debug("Now signed in as {}", loginResponse.getUsername()); AccountSession session = getAccountSession(); session.setUsername(loginResponse.getUsername()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java index 501537654e..2cb1c66ded 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java @@ -75,14 +75,14 @@ public class AccountPlugin extends Plugin loginButton = NavigationButton.builder() .tab(false) .icon(LOGIN_IMAGE) - .tooltip("Log in to RuneLite") + .tooltip("Sign in to RuneLite") .onClick(this::loginClick) .build(); logoutButton = NavigationButton.builder() .tab(false) .icon(LOGOUT_IMAGE) - .tooltip("Log out of RuneLite") + .tooltip("Sign out of RuneLite") .onClick(this::logoutClick) .build(); @@ -113,7 +113,7 @@ public class AccountPlugin extends Plugin private void logoutClick() { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null, - "Are you sure you want to log out from RuneLite?", "Logout Confirmation", + "Are you sure you want to sign out of RuneLite?", "Sign Out Confirmation", JOptionPane.YES_NO_OPTION)) { executor.execute(sessionManager::logout); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java index 5b4df7fe2e..76d543d3fb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/info/InfoPanel.java @@ -184,7 +184,7 @@ public class InfoPanel extends PluginPanel syncPanel = buildLinkPanel(IMPORT_ICON, "Import signed-out", "settings", () -> { final int result = JOptionPane.showOptionDialog(syncPanel, - "This will overwrite your settings with settings from your local profile, which
is the profile used when not logged into RuneLite with a RuneLite account.", + "This will overwrite your settings with settings from your local profile, which
is the profile used when not signed into RuneLite with a RuneLite account.", "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{"Yes", "No"}, "No"); @@ -298,14 +298,14 @@ public class InfoPanel extends PluginPanel { emailLabel.setContentType("text/plain"); emailLabel.setText(name); - loggedLabel.setText("Logged in as"); + loggedLabel.setText("Signed in as"); actionsContainer.add(syncPanel, 0); } else { emailLabel.setContentType("text/html"); - emailLabel.setText("Login to sync settings to the cloud."); - loggedLabel.setText("Not logged in"); + emailLabel.setText("Sign in to sync settings to the cloud."); + loggedLabel.setText("Not signed in"); actionsContainer.remove(syncPanel); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index abf9234a5e..983cfb45a9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -92,7 +92,7 @@ public interface LootTrackerConfig extends Config @ConfigItem( keyName = "syncPanel", name = "Synchronize panel contents", - description = "Synchronize your local loot tracker with your server data (requires being logged in).
" + + description = "Synchronize your local loot tracker with your server data (requires being signed in).
" + " This means the panel is filled with portions of your remote data on startup
" + " and deleting data in the panel also deletes it on the server." ) From ffff30d60c89ea4e33d84b202162e6d60165e907 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Thu, 19 Aug 2021 15:37:45 +0100 Subject: [PATCH 02/32] roof removal: properly account for instances when applying overrides Since instances shift around real regions to WorldPoints that don't match, the override system was trying to apply overrides to areas that don't currently exist. --- .../client/plugins/roofremoval/RoofRemovalPlugin.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java index a9e92f4420..9f86d9a47e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/roofremoval/RoofRemovalPlugin.java @@ -46,6 +46,7 @@ import static net.runelite.api.Constants.ROOF_FLAG_HOVERED; import static net.runelite.api.Constants.ROOF_FLAG_POSITION; import net.runelite.api.GameState; import net.runelite.api.Tile; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GameStateChanged; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; @@ -246,14 +247,17 @@ public class RoofRemovalPlugin extends Plugin continue; } - int regionID = tile.getWorldLocation().getRegionID() << 2 | z; + // Properly account for instances shifting worldpoints around + final WorldPoint wp = WorldPoint.fromLocalInstance(client, tile.getLocalLocation(), tile.getPlane()); + + int regionID = wp.getRegionID() << 2 | z; if (!overrides.containsKey(regionID)) { continue; } - int rx = tile.getWorldLocation().getRegionX(); - int ry = tile.getWorldLocation().getRegionY(); + int rx = wp.getRegionX(); + int ry = wp.getRegionY(); long[] region = overrides.get(regionID); if ((region[ry] & (1L << rx)) != 0) { From faf9e94a7042f6dcf04e5743c705f16839aee9bd Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Mon, 23 Aug 2021 23:34:20 -0700 Subject: [PATCH 03/32] roof removal: Fix Ardougne monastery --- .../client/plugins/roofremoval/overrides.jsonc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc index b831d41f43..656c4ae4dc 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc @@ -3260,5 +3260,15 @@ "z1": 1, "z2": 2 } + ], + "10290": [ // Ardougne Monastery + { + "rx1": 43, + "ry1": 17, + "rx2": 49, + "ry2": 17, + "z1": 0, + "z2": 0 + } ] } From 719022c044b852666b0a1e97b9839e5cb2c69fb5 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 25 Aug 2021 08:06:40 -0400 Subject: [PATCH 04/32] Update world types for seasonal deadman --- .../runelite/http/api/worlds/WorldType.java | 6 +++--- .../http/service/worlds/ServiceWorldType.java | 6 +++--- .../main/java/net/runelite/api/WorldType.java | 19 ++++++++----------- .../client/config/RuneScapeProfileType.java | 4 ++-- .../chatcommands/ChatCommandsPlugin.java | 10 +++++----- .../grandexchange/GrandExchangePlugin.java | 4 ++-- .../client/plugins/hiscore/HiscorePlugin.java | 6 +----- .../opponentinfo/OpponentInfoPlugin.java | 6 +----- .../plugins/worldhopper/WorldTableRow.java | 8 ++++---- .../client/plugins/xptracker/XpInfoBox.java | 3 +-- .../client/plugins/xptracker/XpPanel.java | 9 +++------ .../client/plugins/xptracker/XpWorldType.java | 4 +--- .../plugins/xpupdater/XpUpdaterPlugin.java | 12 ++++++------ 13 files changed, 40 insertions(+), 57 deletions(-) diff --git a/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java b/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java index 9e6ae694e3..20639b5f3c 100644 --- a/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java +++ b/http-api/src/main/java/net/runelite/http/api/worlds/WorldType.java @@ -32,8 +32,8 @@ public enum WorldType SKILL_TOTAL, HIGH_RISK, LAST_MAN_STANDING, - TOURNAMENT, + NOSAVE_MODE, DEADMAN, - DEADMAN_TOURNAMENT, - LEAGUE; + TOURNAMENT, + SEASONAL; } diff --git a/http-service/src/main/java/net/runelite/http/service/worlds/ServiceWorldType.java b/http-service/src/main/java/net/runelite/http/service/worlds/ServiceWorldType.java index d0a7b62103..642cd0440a 100644 --- a/http-service/src/main/java/net/runelite/http/service/worlds/ServiceWorldType.java +++ b/http-service/src/main/java/net/runelite/http/service/worlds/ServiceWorldType.java @@ -34,10 +34,10 @@ enum ServiceWorldType SKILL_TOTAL(WorldType.SKILL_TOTAL, 1 << 7), HIGH_RISK(WorldType.HIGH_RISK, 1 << 10), LAST_MAN_STANDING(WorldType.LAST_MAN_STANDING, 1 << 14), - TOURNAMENT(WorldType.TOURNAMENT, 1 << 25), - DEADMAN_TOURNAMENT(WorldType.DEADMAN_TOURNAMENT, 1 << 26), + NOSAVE_MODE(WorldType.NOSAVE_MODE, 1 << 25), + TOURNAMENT(WorldType.TOURNAMENT, 1 << 26), DEADMAN(WorldType.DEADMAN, 1 << 29), - LEAGUE(WorldType.LEAGUE, 1 << 30); + SEASONAL(WorldType.SEASONAL, 1 << 30); private final WorldType apiType; private final int mask; diff --git a/runelite-api/src/main/java/net/runelite/api/WorldType.java b/runelite-api/src/main/java/net/runelite/api/WorldType.java index 2bd54cf0ed..27162fab2d 100644 --- a/runelite-api/src/main/java/net/runelite/api/WorldType.java +++ b/runelite-api/src/main/java/net/runelite/api/WorldType.java @@ -26,10 +26,12 @@ package net.runelite.api; import java.util.Collection; import java.util.EnumSet; +import lombok.AllArgsConstructor; /** * An enumeration of possible world types. */ +@AllArgsConstructor public enum WorldType { /** @@ -57,29 +59,24 @@ public enum WorldType */ LAST_MAN_STANDING(1 << 14), /** - * Tournament world type. + * Beta worlds without profiles that are saved. */ - TOURNAMENT(1 << 25), + NOSAVE_MODE(1 << 25), /** - * Deadman Tournament world type. + * Tournament world type */ - DEADMAN_TOURNAMENT(1 << 26), + TOURNAMENT_WORLD(1 << 26), /** * Deadman world type. */ DEADMAN(1 << 29), /** - * League world type + * Seasonal world type for leagues and seasonal deadman. */ - LEAGUE(1 << 30); + SEASONAL(1 << 30); private final int mask; - WorldType(int mask) - { - this.mask = mask; - } - private static final EnumSet PVP_WORLD_TYPES = EnumSet.of( DEADMAN, // dmmt worlds are also flaged as DEADMAN PVP diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java index d82fc13f69..8eba74cd4d 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneScapeProfileType.java @@ -35,10 +35,10 @@ import net.runelite.api.WorldType; public enum RuneScapeProfileType { STANDARD(client -> true), - BETA(client -> client.getWorldType().contains(WorldType.TOURNAMENT)), + BETA(client -> client.getWorldType().contains(WorldType.NOSAVE_MODE)), DEADMAN(client -> client.getWorldType().contains(WorldType.DEADMAN)), TRAILBLAZER_LEAGUE, - DEADMAN_REBORN(client -> client.getWorldType().contains(WorldType.DEADMAN_TOURNAMENT)) + DEADMAN_REBORN(client -> client.getWorldType().contains(WorldType.SEASONAL)) ; private final Predicate test; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 01b29fe814..9168c8f150 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -1738,12 +1738,12 @@ public class ChatCommandsPlugin extends Plugin return new HiscoreLookup(localPlayer.getName(), hiscoreEndpoint); } - // Public chat on a leagues world is always league hiscores, regardless of icon if (chatMessage.getType() == ChatMessageType.PUBLICCHAT || chatMessage.getType() == ChatMessageType.MODCHAT) { - if (client.getWorldType().contains(WorldType.LEAGUE)) + // Public chat on a seasonal world is always seasonal or tournament hiscores, regardless of icon + if (client.getWorldType().contains(WorldType.SEASONAL)) { - return new HiscoreLookup(player, HiscoreEndpoint.LEAGUE); + return new HiscoreLookup(player, HiscoreEndpoint.TOURNAMENT); } } @@ -1789,9 +1789,9 @@ public class ChatCommandsPlugin extends Plugin private HiscoreEndpoint getLocalHiscoreEndpointType() { EnumSet worldType = client.getWorldType(); - if (worldType.contains(WorldType.LEAGUE)) + if (worldType.contains(WorldType.SEASONAL)) { - return HiscoreEndpoint.LEAGUE; + return HiscoreEndpoint.TOURNAMENT; } return toEndPoint(client.getAccountType()); 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 53f3276b12..a8dd17da60 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 @@ -479,9 +479,9 @@ public class GrandExchangePlugin extends Plugin private WorldType getGeWorldType() { EnumSet worldTypes = client.getWorldType(); - if (worldTypes.contains(net.runelite.api.WorldType.DEADMAN_TOURNAMENT)) + if (worldTypes.contains(net.runelite.api.WorldType.SEASONAL)) { - return WorldType.DEADMAN_TOURNAMENT; + return WorldType.SEASONAL; } else if (worldTypes.contains(net.runelite.api.WorldType.DEADMAN)) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java index 7f1f65606e..37f298c4ab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java @@ -265,7 +265,7 @@ public class HiscorePlugin extends Plugin { EnumSet wTypes = client.getWorldType(); - if (wTypes.contains(WorldType.DEADMAN_TOURNAMENT)) + if (wTypes.contains(WorldType.SEASONAL)) { return HiscoreEndpoint.TOURNAMENT; } @@ -273,10 +273,6 @@ public class HiscorePlugin extends Plugin { return HiscoreEndpoint.DEADMAN; } - else if (wTypes.contains(WorldType.LEAGUE)) - { - return HiscoreEndpoint.LEAGUE; - } } return HiscoreEndpoint.NORMAL; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java index 65fcf0af05..4d58b924d1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java @@ -116,7 +116,7 @@ public class OpponentInfoPlugin extends Plugin } final EnumSet worldType = client.getWorldType(); - if (worldType.contains(WorldType.DEADMAN_TOURNAMENT)) + if (worldType.contains(WorldType.SEASONAL)) { hiscoreEndpoint = HiscoreEndpoint.TOURNAMENT; } @@ -124,10 +124,6 @@ public class OpponentInfoPlugin extends Plugin { hiscoreEndpoint = HiscoreEndpoint.DEADMAN; } - else if (worldType.contains(WorldType.LEAGUE)) - { - hiscoreEndpoint = HiscoreEndpoint.LEAGUE; - } else { hiscoreEndpoint = HiscoreEndpoint.NORMAL; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java index fc46f386da..6c9a6b9ef2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java @@ -62,7 +62,7 @@ class WorldTableRow extends JPanel private static final Color TOURNAMENT_WORLD = new Color(79, 145, 255); private static final Color MEMBERS_WORLD = new Color(210, 193, 53); private static final Color FREE_WORLD = new Color(200, 200, 200); - private static final Color LEAGUE_WORLD = new Color(133, 177, 178); + private static final Color SEASONAL_WORLD = new Color(133, 177, 178); static { @@ -253,11 +253,11 @@ class WorldTableRow extends JPanel { activityField.setForeground(DANGEROUS_WORLD); } - else if (world.getTypes().contains(WorldType.LEAGUE)) + else if (world.getTypes().contains(WorldType.SEASONAL)) { - activityField.setForeground(LEAGUE_WORLD); + activityField.setForeground(SEASONAL_WORLD); } - else if (world.getTypes().contains(WorldType.TOURNAMENT)) + else if (world.getTypes().contains(WorldType.NOSAVE_MODE)) { activityField.setForeground(TOURNAMENT_WORLD); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index 5d41b055c6..dbcfd6ddbd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -50,7 +50,6 @@ import lombok.Getter; import net.runelite.api.Client; import net.runelite.api.Experience; import net.runelite.api.Skill; -import net.runelite.api.WorldType; import net.runelite.client.game.SkillIconManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.DynamicGridLayout; @@ -125,7 +124,7 @@ class XpInfoBox extends JPanel // Create open xp tracker menu final JMenuItem openXpTracker = new JMenuItem("Open Wise Old Man"); openXpTracker.addActionListener(e -> LinkBrowser.browse(XpPanel.buildXpTrackerUrl( - client.getLocalPlayer(), skill, client.getWorldType().contains(WorldType.LEAGUE)))); + client.getLocalPlayer(), skill))); // Create reset menu final JMenuItem reset = new JMenuItem("Reset"); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java index b346f2733d..ed72128ef4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java @@ -41,7 +41,6 @@ import javax.swing.border.EmptyBorder; import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.Skill; -import net.runelite.api.WorldType; import net.runelite.client.game.SkillIconManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; @@ -84,7 +83,7 @@ class XpPanel extends PluginPanel // Create open xp tracker menu final JMenuItem openXpTracker = new JMenuItem("Open Wise Old Man"); openXpTracker.addActionListener(e -> LinkBrowser.browse(XpPanel.buildXpTrackerUrl( - client.getLocalPlayer(), Skill.OVERALL, client.getWorldType().contains(WorldType.LEAGUE)))); + client.getLocalPlayer(), Skill.OVERALL))); // Create reset all menu final JMenuItem reset = new JMenuItem("Reset All"); @@ -147,18 +146,16 @@ class XpPanel extends PluginPanel add(errorPanel); } - static String buildXpTrackerUrl(final Actor player, final Skill skill, boolean leagueWorld) + static String buildXpTrackerUrl(final Actor player, final Skill skill) { if (player == null) { return ""; } - final String host = leagueWorld ? "trailblazer.wiseoldman.net" : "wiseoldman.net"; - return new HttpUrl.Builder() .scheme("https") - .host(host) + .host("wiseoldman.net") .addPathSegment("players") .addPathSegment(player.getName()) .addPathSegment("gained") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java index 245057e209..909a7de841 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java @@ -70,12 +70,10 @@ enum XpWorldType { switch (type) { - case TOURNAMENT: + case NOSAVE_MODE: return TOURNEY; case DEADMAN: return DMM; - case LEAGUE: - return LEAGUE; default: return NORMAL; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java index 73f295ccaa..4595a9f722 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java @@ -143,9 +143,9 @@ public class XpUpdaterPlugin extends Plugin private void updateCml(String username, EnumSet worldTypes) { if (config.cml() - && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.SEASONAL) && !worldTypes.contains(WorldType.DEADMAN) - && !worldTypes.contains(WorldType.TOURNAMENT)) + && !worldTypes.contains(WorldType.NOSAVE_MODE)) { HttpUrl url = new HttpUrl.Builder() .scheme("https") @@ -168,9 +168,9 @@ public class XpUpdaterPlugin extends Plugin private void updateTempleosrs(String username, EnumSet worldTypes) { if (config.templeosrs() - && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.SEASONAL) && !worldTypes.contains(WorldType.DEADMAN) - && !worldTypes.contains(WorldType.TOURNAMENT)) + && !worldTypes.contains(WorldType.NOSAVE_MODE)) { HttpUrl url = new HttpUrl.Builder() .scheme("https") @@ -192,9 +192,9 @@ public class XpUpdaterPlugin extends Plugin private void updateWom(String username, EnumSet worldTypes) { if (config.wiseoldman() - && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.SEASONAL) && !worldTypes.contains(WorldType.DEADMAN) - && !worldTypes.contains(WorldType.TOURNAMENT)) + && !worldTypes.contains(WorldType.NOSAVE_MODE)) { HttpUrl url = new HttpUrl.Builder() .scheme("https") From ed5ae02bc39b620098954cf50d67f52a21227bcc Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 25 Aug 2021 09:15:26 -0400 Subject: [PATCH 05/32] world hopper: set activity tooltip on world list --- .../runelite/client/plugins/worldhopper/WorldTableRow.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java index 6c9a6b9ef2..cc0278ee5a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java @@ -311,8 +311,13 @@ class WorldTableRow extends JPanel JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); - activityField = new JLabel(world.getActivity()); + String activity = world.getActivity(); + activityField = new JLabel(activity); activityField.setFont(FontManager.getRunescapeSmallFont()); + if (activity != null && activity.length() > 16) + { + activityField.setToolTipText(activity); + } column.add(activityField, BorderLayout.WEST); From 6723fb3205e4a5a784be0c33a17c721ce4e12a99 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 26 Aug 2021 22:26:02 -0400 Subject: [PATCH 06/32] overlay: only layout widget overlays if the preferred location is set With the new steam client updates, the client tries to aggressively move around several of the widget overlay components, including xp tracker, and several hp bars. This tends to fight with the layouting we already do with the widgets. This changes the widgets to only be layouted if the overlay has a preferred location or position set. Otherwise, it will offset the snap corner bounds by where the client has positione the widget. It is still possible to get the client ui to fight the widget overlay by moving the overlays around manually, but it should no longer happen in the default positioning of the widgets. --- .../runelite/client/ui/overlay/Overlay.java | 5 +--- .../client/ui/overlay/OverlayManager.java | 5 +++- .../client/ui/overlay/OverlayRenderer.java | 24 ++++++++--------- .../client/ui/overlay/OverlayUtil.java | 26 +++++++++---------- .../client/ui/overlay/WidgetOverlay.java | 9 +++---- 5 files changed, 34 insertions(+), 35 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java index 14197b90a1..c852f32b53 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/Overlay.java @@ -121,10 +121,7 @@ public abstract class Overlay implements LayoutableRenderableEntity return null; } - public void reset() + public void revalidate() { - setPreferredPosition(null); - setPreferredSize(null); - setPreferredLocation(null); } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java index 21cb834ca1..bea3f9d280 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayManager.java @@ -289,8 +289,11 @@ public class OverlayManager */ public synchronized void resetOverlay(final Overlay overlay) { - overlay.reset(); + overlay.setPreferredPosition(null); + overlay.setPreferredSize(null); + overlay.setPreferredLocation(null); saveOverlay(overlay); + overlay.revalidate(); } synchronized void rebuildOverlayLayers() diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index d70b043911..463e05725e 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -272,25 +272,18 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener final Dimension dimension = bounds.getSize(); final Point preferredLocation = overlay.getPreferredLocation(); Point location; + Rectangle snapCorner = null; // If the final position is not modified, layout it if (overlayPosition != OverlayPosition.DETACHED && (preferredLocation == null || overlay.getPreferredPosition() != null)) { - final Rectangle snapCorner = snapCorners.forPosition(overlayPosition); + snapCorner = snapCorners.forPosition(overlayPosition); final Point translation = OverlayUtil.transformPosition(overlayPosition, dimension); // offset from corner // Target x/y to draw the overlay - int destX = (int) snapCorner.getX() + translation.x; - int destY = (int) snapCorner.getY() + translation.y; + int destX = snapCorner.x + translation.x; + int destY = snapCorner.y + translation.y; // Clamp the target position to ensure it is on screen or within parent bounds location = clampOverlayLocation(destX, destY, dimension.width, dimension.height, overlay); - // Diff final position to target position in order to add it to the snap corner padding. The - // overlay effectively takes up the difference of (clamped location - target location) in - // addition to its normal dimensions. - int dX = location.x - destX; - int dY = location.y - destY; - final Point padding = OverlayUtil.padPosition(overlayPosition, dimension, PADDING); // overlay size + fixed padding - // translate corner for padding and any difference due to the position clamping - snapCorner.translate(padding.x + dX, padding.y + dY); } else { @@ -307,6 +300,12 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener safeRender(client, overlay, layer, graphics, location); + // Adjust snap corner based on where the overlay was drawn + if (snapCorner != null && bounds.width + bounds.height > 0) + { + OverlayUtil.shiftSnapCorner(overlayPosition, snapCorner, bounds, PADDING); + } + // Restore graphics2d properties prior to drawing bounds graphics.setTransform(transform); graphics.setStroke(stroke); @@ -665,7 +664,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener { OverlayPosition position = snapCorners.fromBounds(snapCorner); - if (position == currentManagedOverlay.getPosition()) + if (position == getCorrectedOverlayPosition(currentManagedOverlay)) { // overlay moves back to default position position = null; @@ -673,6 +672,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener currentManagedOverlay.setPreferredPosition(position); currentManagedOverlay.setPreferredLocation(null); // from dragging + currentManagedOverlay.revalidate(); break; } } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java index 1caa3a7c01..26497ab43d 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayUtil.java @@ -30,6 +30,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; +import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.Stroke; @@ -201,33 +202,32 @@ public class OverlayUtil graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } - public static java.awt.Point padPosition(OverlayPosition position, Dimension dimension, final int padding) + static void shiftSnapCorner(OverlayPosition overlayPosition, Rectangle snapCorner, Rectangle bounds, int padding) { - final java.awt.Point result = new java.awt.Point(); - - switch (position) + // translate corner for padding and also based on where the overlay bounds are now + int sX = snapCorner.x, sY = snapCorner.y; + switch (overlayPosition) { - case DYNAMIC: - case TOOLTIP: - break; case BOTTOM_LEFT: - result.x += dimension.width + (dimension.width == 0 ? 0 : padding); + sX = bounds.x + bounds.width + padding; break; case BOTTOM_RIGHT: - result.x -= dimension.width + (dimension.width == 0 ? 0 : padding); + sX = bounds.x - padding; break; case TOP_LEFT: case TOP_CENTER: case CANVAS_TOP_RIGHT: case TOP_RIGHT: - result.y += dimension.height + (dimension.height == 0 ? 0 : padding); + sY = bounds.y + bounds.height + padding; break; case ABOVE_CHATBOX_RIGHT: - result.y -= dimension.height + (dimension.height == 0 ? 0 : padding); + sY = bounds.y - padding; break; + default: + throw new IllegalArgumentException(); } - - return result; + snapCorner.x = sX; + snapCorner.y = sY; } public static java.awt.Point transformPosition(OverlayPosition position, Dimension dimension) 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 67d20cf8bd..43a1faf32e 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 @@ -121,9 +121,9 @@ public class WidgetOverlay extends Overlay assert widget != null; final Rectangle bounds = getBounds(); - // OverlayRenderer sets the overlay bounds to the preferred location if one is set prior to calling render() - // for detached overlays. - if (getPosition() != OverlayPosition.DETACHED || getPreferredLocation() != null) + // OverlayRenderer sets the overlay bounds to where it would like the overlay to render at prior to calling + // render(). If the overlay has a preferred location or position set we update the widget position to that. + if (getPreferredLocation() != null || getPreferredPosition() != null) { // The widget relative pos is relative to the parent widget.setRelativeX(bounds.x - parent.x); @@ -188,9 +188,8 @@ public class WidgetOverlay extends Overlay } @Override - public void reset() + public void revalidate() { - super.reset(); // Revalidate must be called on the client thread, so defer til next frame revalidate = true; } From 50c6100596c4ab05d072a443819f0e37cad9d66c Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Wed, 23 Dec 2020 09:52:45 +0000 Subject: [PATCH 07/32] loot tracker: add ea display to tooltips --- .../plugins/loottracker/LootTrackerBox.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index f0248b19be..0e6196227f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -375,8 +375,19 @@ class LootTrackerBox extends JPanel final long gePrice = item.getTotalGePrice(); final long haPrice = item.getTotalHaPrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return "" + name + " x " + quantity + ignoredLabel - + "
GE: " + QuantityFormatter.quantityToStackSize(gePrice) - + "
HA: " + QuantityFormatter.quantityToStackSize(haPrice) + ""; + final StringBuilder sb = new StringBuilder(""); + sb.append(name).append(" x ").append(QuantityFormatter.formatNumber(quantity)).append(ignoredLabel); + sb.append("
GE: ").append(QuantityFormatter.quantityToStackSize(gePrice)); + if (quantity > 1) + { + sb.append(" (").append(QuantityFormatter.quantityToStackSize(item.getGePrice())).append(" ea)"); + } + sb.append("
HA: ").append(QuantityFormatter.quantityToStackSize(haPrice)); + if (quantity > 1) + { + sb.append(" (").append(QuantityFormatter.quantityToStackSize(item.getHaPrice())).append(" ea)"); + } + sb.append(""); + return sb.toString(); } } From 8b683b40570fbf10871ebbaa516f18083dbdc4a6 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Wed, 23 Dec 2020 09:53:16 +0000 Subject: [PATCH 08/32] loot tracker: don't show unneeded tooltip lines for coins and platinum --- .../client/plugins/loottracker/LootTrackerBox.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 0e6196227f..16da3c9460 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -50,6 +50,7 @@ import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import lombok.AccessLevel; import lombok.Getter; +import net.runelite.api.ItemID; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; @@ -377,11 +378,24 @@ class LootTrackerBox extends JPanel final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; final StringBuilder sb = new StringBuilder(""); sb.append(name).append(" x ").append(QuantityFormatter.formatNumber(quantity)).append(ignoredLabel); + if (item.getId() == ItemID.COINS_995) + { + sb.append(""); + return sb.toString(); + } + sb.append("
GE: ").append(QuantityFormatter.quantityToStackSize(gePrice)); if (quantity > 1) { sb.append(" (").append(QuantityFormatter.quantityToStackSize(item.getGePrice())).append(" ea)"); } + + if (item.getId() == ItemID.PLATINUM_TOKEN) + { + sb.append(""); + return sb.toString(); + } + sb.append("
HA: ").append(QuantityFormatter.quantityToStackSize(haPrice)); if (quantity > 1) { From a772eebf094af95a7195167f0cf778085d5683d3 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 27 Aug 2021 14:12:15 -0400 Subject: [PATCH 09/32] world hopper: bubble up mouse events from activity label This fixes hopping and mouseover on the activity label not working --- .../plugins/worldhopper/WorldTableRow.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java index cc0278ee5a..29ba121129 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java @@ -317,6 +317,39 @@ class WorldTableRow extends JPanel if (activity != null && activity.length() > 16) { activityField.setToolTipText(activity); + // Pass up events - https://stackoverflow.com/a/14932443 + activityField.addMouseListener(new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + dispatchEvent(e); + } + + @Override + public void mousePressed(MouseEvent e) + { + dispatchEvent(e); + } + + @Override + public void mouseReleased(MouseEvent e) + { + dispatchEvent(e); + } + + @Override + public void mouseEntered(MouseEvent e) + { + dispatchEvent(e); + } + + @Override + public void mouseExited(MouseEvent e) + { + dispatchEvent(e); + } + }); } column.add(activityField, BorderLayout.WEST); From f1df57f9dd7574707469b944cbfef6900c461b80 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Sun, 29 Aug 2021 15:36:52 -0600 Subject: [PATCH 10/32] timetracking: don't load notification icons for every panel --- .../client/plugins/timetracking/TimeablePanel.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java index 1a8b23a8fa..8903a0b715 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java @@ -46,6 +46,9 @@ import net.runelite.client.util.SwingUtil; @Getter public class TimeablePanel extends JPanel { + private static final ImageIcon NOTIFY_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_icon.png")); + private static final ImageIcon NOTIFY_SELECTED_ICON = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_selected_icon.png")); + private final T timeable; private final JLabel icon = new JLabel(); private final JLabel farmingContractIcon = new JLabel(); @@ -84,13 +87,10 @@ public class TimeablePanel extends JPanel infoPanel.add(text); infoPanel.add(estimate); - ImageIcon notifyIcon = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_icon.png")); - ImageIcon notifySelectedIcon = new ImageIcon(ImageUtil.loadImageResource(TimeTrackingPlugin.class, "notify_selected_icon.png")); - notifyButton.setPreferredSize(new Dimension(30, 16)); notifyButton.setBorder(new EmptyBorder(0, 0, 0, 10)); - notifyButton.setIcon(notifyIcon); - notifyButton.setSelectedIcon(notifySelectedIcon); + notifyButton.setIcon(NOTIFY_ICON); + notifyButton.setSelectedIcon(NOTIFY_SELECTED_ICON); SwingUtil.removeButtonDecorations(notifyButton); SwingUtil.addModalTooltip(notifyButton, "Disable notifications", "Enable notifications"); From 49c24f2651449f395f9ac2eba77dd339465b75c9 Mon Sep 17 00:00:00 2001 From: SkylerPIlot Date: Sun, 29 Aug 2021 19:29:03 -0700 Subject: [PATCH 11/32] skill calculator: Add Morytania diary shade exp bonus --- .../plugins/skillcalculator/skill_prayer.json | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json index 292fab6b8f..6a0ef8a98f 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json @@ -11,6 +11,10 @@ { "name": "Chaos Altar (700%)", "value": 6 + }, + { + "name": "Morytania Diary 3 Shades(150%)", + "value": 0.5 } ], "actions": [ @@ -184,8 +188,7 @@ "level": 1, "icon": 3396, "name": "Loar Remains", - "xp": 33, - "ignoreBonus": true + "xp": 33 }, { "level": 1, @@ -239,8 +242,7 @@ "level": 1, "icon": 3398, "name": "Phrin Remains", - "xp": 46.5, - "ignoreBonus": true + "xp": 46.5 }, { "level": 1, @@ -252,8 +254,7 @@ "level": 1, "icon": 3400, "name": "Riyl Remains", - "xp": 59.5, - "ignoreBonus": true + "xp": 59.5 }, { "level": 1, @@ -277,8 +278,7 @@ "level": 1, "icon": 3402, "name": "Asyn Remains", - "xp": 82.5, - "ignoreBonus": true + "xp": 82.5 }, { "level": 1, @@ -290,8 +290,7 @@ "level": 1, "icon": 3404, "name": "Fiyr Remains", - "xp": 84, - "ignoreBonus": true + "xp": 84 }, { "level": 1, From 8b5f4fe8dee0a45f4895dda5c575b86802020196 Mon Sep 17 00:00:00 2001 From: SkylerPIlot Date: Sun, 29 Aug 2021 19:30:28 -0700 Subject: [PATCH 12/32] skill calculator: Add Urium remains --- .../client/plugins/skillcalculator/skill_prayer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json index 6a0ef8a98f..1ddc633f4b 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json @@ -327,6 +327,12 @@ "icon": 22124, "name": "Superior Dragon Bones", "xp": 150 + }, + { + "level": 1, + "icon": 25419, + "name": "Urium Remains", + "xp": 120 } ] } From 7046737a480f7deeaffa6f41725af295bab3d93f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Fri, 27 Aug 2021 17:13:34 +0100 Subject: [PATCH 13/32] xp globes: account for progress arc width when deciding overlay bounds --- .../plugins/xpglobes/XpGlobesOverlay.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java index 526d3aacbc..1243c76712 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java @@ -63,6 +63,7 @@ public class XpGlobesOverlay extends Overlay private static final int MINIMUM_STEP = 10; private static final int PROGRESS_RADIUS_START = 90; private static final int PROGRESS_RADIUS_REMAINDER = 0; + private static final int PROGRESS_BACKGROUND_SIZE = 5; private static final int TOOLTIP_RECT_SIZE_X = 150; private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180); static final String FLIP_ACTION = "Flip"; @@ -108,31 +109,34 @@ public class XpGlobesOverlay extends Overlay return null; } - int curDrawPosition = 0; + // The progress arc is drawn either side of the perimeter of the background. This value accounts for that + // when calculating draw positions and overall size of the overlay + final int progressArcOffset = (int) Math.ceil(Math.max(PROGRESS_BACKGROUND_SIZE, config.progressArcStrokeWidth()) / 2.0); + int curDrawPosition = progressArcOffset; for (final XpGlobe xpGlobe : xpGlobes) { int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill()); int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill()); if (config.alignOrbsVertically()) { - renderProgressCircle(graphics, xpGlobe, startXp, goalXp, 0, curDrawPosition, getBounds()); + renderProgressCircle(graphics, xpGlobe, startXp, goalXp, progressArcOffset, curDrawPosition, getBounds()); } else { - renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, 0, getBounds()); + renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawPosition, progressArcOffset, getBounds()); } curDrawPosition += MINIMUM_STEP + config.xpOrbSize(); } // Get length of markers - final int markersLength = (queueSize * (config.xpOrbSize())) + ((MINIMUM_STEP) * (queueSize - 1)); + final int markersLength = (queueSize * (config.xpOrbSize() + progressArcOffset)) + ((MINIMUM_STEP) * (queueSize - 1)); if (config.alignOrbsVertically()) { - return new Dimension(config.xpOrbSize(), markersLength); + return new Dimension(config.xpOrbSize() + progressArcOffset * 2, markersLength); } else { - return new Dimension(markersLength, config.xpOrbSize()); + return new Dimension(markersLength, config.xpOrbSize() + progressArcOffset * 2); } } @@ -184,7 +188,7 @@ public class XpGlobesOverlay extends Overlay x, y, config.xpOrbSize(), config.xpOrbSize(), PROGRESS_RADIUS_REMAINDER, radiusToGoalXp, - 5, + PROGRESS_BACKGROUND_SIZE, config.progressOrbOutLineColor() ); drawProgressArc( From b42932d581174bf1641b4e882a49f2a655a5528a Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 29 Aug 2021 14:36:09 -0400 Subject: [PATCH 14/32] loot tracker: add world id to loot record for dmmt --- .../net/runelite/http/api/loottracker/LootRecord.java | 1 + .../client/plugins/loottracker/LootTrackerPlugin.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java index 01e180c55b..a8e04aefd3 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootRecord.java @@ -40,4 +40,5 @@ public class LootRecord private Object metadata; private Collection drops; private Instant time; + private Integer world; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 634a1fcc77..5519be978a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -74,6 +74,7 @@ import net.runelite.api.ObjectID; import net.runelite.api.Player; import net.runelite.api.Skill; import net.runelite.api.SpriteID; +import net.runelite.api.WorldType; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; @@ -479,7 +480,7 @@ public class LootTrackerPlugin extends Plugin if (config.saveLoot()) { - LootRecord lootRecord = new LootRecord(name, type, metadata, toGameItems(items), Instant.now()); + LootRecord lootRecord = new LootRecord(name, type, metadata, toGameItems(items), Instant.now(), getLootWorldId()); synchronized (queuedLoots) { queuedLoots.add(lootRecord); @@ -489,6 +490,12 @@ public class LootTrackerPlugin extends Plugin eventBus.post(new LootReceived(name, combatLevel, type, items)); } + private Integer getLootWorldId() + { + // For the wiki to determine drop rates based on dmm brackets + return client.getWorldType().contains(WorldType.SEASONAL) ? client.getWorld() : null; + } + @Subscribe public void onNpcLootReceived(final NpcLootReceived npcLootReceived) { From e37292267b763862a21e89e4e8247d0e739646d0 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 30 Aug 2021 20:33:55 -0400 Subject: [PATCH 15/32] use maven's native reproducible build support Co-authored-by: Max Weber --- pom.xml | 32 +++++++++++++----------- runelite-client/pom.xml | 7 +----- runelite-script-assembler-plugin/pom.xml | 1 - 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index e99b83af3d..d487454096 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,7 @@ UTF-8 + 1 1.8 8 1.18.20 @@ -280,33 +281,34 @@ true - - io.github.zlika - reproducible-build-maven-plugin - 0.7 - - - - package - - strip-jar - - - - + + org.apache.maven.plugins + maven-assembly-plugin + 3.2.0 + org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.2.0 org.apache.maven.plugins maven-compiler-plugin 3.6.1 + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + + org.apache.maven.plugins + maven-plugin-plugin + 3.6.0 + diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index a6b0870fb4..debecf5638 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -318,7 +318,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.2.3 package @@ -338,11 +338,6 @@ - - - io.github.zlika - reproducible-build-maven-plugin - org.apache.maven.plugins maven-jarsigner-plugin diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index f79c779388..393e17c640 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -65,7 +65,6 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 default-descriptor From 41d338435825f064f7ae6ea10a72e152f7b19d69 Mon Sep 17 00:00:00 2001 From: Adam Davies Date: Mon, 14 Jun 2021 15:22:39 -0500 Subject: [PATCH 16/32] mining: Add barronite ore and deposits --- .../client/plugins/mining/MiningPlugin.java | 20 ++++++++++++++++--- .../runelite/client/plugins/mining/Rock.java | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) 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 6cc0e90ae4..67edf4a1e5 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 @@ -50,6 +50,10 @@ import static net.runelite.api.ObjectID.ORE_VEIN_26661; import static net.runelite.api.ObjectID.ORE_VEIN_26662; import static net.runelite.api.ObjectID.ORE_VEIN_26663; import static net.runelite.api.ObjectID.ORE_VEIN_26664; +import static net.runelite.api.ObjectID.ROCKS_41547; +import static net.runelite.api.ObjectID.ROCKS_41548; +import static net.runelite.api.ObjectID.ROCKS_41549; +import static net.runelite.api.ObjectID.ROCKS_41550; import net.runelite.api.Player; import net.runelite.api.WallObject; import net.runelite.api.coords.WorldPoint; @@ -79,12 +83,12 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; @PluginDependency(XpTrackerPlugin.class) public class MiningPlugin extends Plugin { - private static final Pattern MINING_PATERN = Pattern.compile( + private static final Pattern MINING_PATTERN = Pattern.compile( "You " + "(?:manage to|just)" + " (?:mined?|quarry) " + "(?:some|an?) " + - "(?:copper|tin|clay|iron|silver|coal|gold|mithril|adamantite|runeite|amethyst|sandstone|granite|Opal|piece of Jade|Red Topaz|Emerald|Sapphire|Ruby|Diamond)" + + "(?:copper|tin|clay|iron|silver|coal|gold|mithril|adamantite|runeite|amethyst|sandstone|granite|barronite shards|barronite deposit|Opal|piece of Jade|Red Topaz|Emerald|Sapphire|Ruby|Diamond)" + "(?:\\.|!)"); @Inject @@ -343,10 +347,20 @@ public class MiningPlugin extends Plugin respawns.add(rockRespawn); break; } + case ROCKS_41549: // Depleted barronite vein + case ROCKS_41550: // Depleted barronite vein + { + Rock rock = Rock.BARRONITE; + RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset()); + respawns.add(rockRespawn); + break; + } case ORE_VEIN_26661: // Motherlode vein case ORE_VEIN_26662: // Motherlode vein case ORE_VEIN_26663: // Motherlode vein case ORE_VEIN_26664: // Motherlode vein + case ROCKS_41547: // Barronite vein + case ROCKS_41548: // Barronite vein { // If the vein respawns before the timer is up, remove it final WorldPoint point = object.getWorldLocation(); @@ -361,7 +375,7 @@ public class MiningPlugin extends Plugin { if (event.getType() == ChatMessageType.SPAM || event.getType() == ChatMessageType.GAMEMESSAGE) { - if (MINING_PATERN.matcher(event.getMessage()).matches()) + if (MINING_PATTERN.matcher(event.getMessage()).matches()) { if (session == null) { 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 4f8cf9b32f..ac28366b8b 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 @@ -97,7 +97,8 @@ enum Rock EFH_SALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33255), TE_SALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33256), BASALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33257), - DAEYALT_ESSENCE(Duration.of(MiningRocksOverlay.DAEYALT_MAX_RESPAWN_TIME, GAME_TICKS), 0, DAEYALT_ESSENCE_39095); + DAEYALT_ESSENCE(Duration.of(MiningRocksOverlay.DAEYALT_MAX_RESPAWN_TIME, GAME_TICKS), 0, DAEYALT_ESSENCE_39095), + BARRONITE(Duration.of(89, GAME_TICKS), 140); private static final int WILDERNESS_RESOURCE_AREA = 12605; private static final int MISCELLANIA = 10044; From b9025997a11789a10999eba1c1bf6bc4d4c0742d Mon Sep 17 00:00:00 2001 From: pilino1234 Date: Tue, 31 Aug 2021 14:36:19 +0200 Subject: [PATCH 17/32] skillcalculator: Add Camdozaal activities --- .../skillcalculator/skill_cooking.json | 24 +++++++++++++++++++ .../skillcalculator/skill_fishing.json | 24 +++++++++++++++++++ .../plugins/skillcalculator/skill_mining.json | 12 ++++++++++ .../plugins/skillcalculator/skill_prayer.json | 24 +++++++++++++++++++ .../skillcalculator/skill_runecraft.json | 18 ++++++++++++++ .../skillcalculator/skill_smithing.json | 6 +++++ 6 files changed, 108 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json index 6ddb07cbaf..8e86a25a65 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json @@ -78,6 +78,12 @@ "name": "Baked Potato", "xp": 15 }, + { + "level": 7, + "icon": 25654, + "name": "Guppy", + "xp": 12 + }, { "level": 8, "icon": 2048, @@ -228,6 +234,12 @@ "name": "Cup of tea", "xp": 52 }, + { + "level": 20, + "icon": 25660, + "name": "Cavefish", + "xp": 23 + }, { "level": 21, "icon": 9988, @@ -378,6 +390,12 @@ "name": "Choc Saturday", "xp": 170 }, + { + "level": 33, + "icon": 25666, + "name": "Tetra", + "xp": 31 + }, { "level": 34, "icon": 7178, @@ -516,6 +534,12 @@ "name": "Fried Mushrooms", "xp": 60 }, + { + "level": 46, + "icon": 25672, + "name": "Catfish", + "xp": 43 + }, { "level": 47, "icon": 7188, diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json index f55759fece..730be09d00 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json @@ -24,6 +24,12 @@ "name": "Raw Karambwanji", "xp": 5 }, + { + "level": 7, + "icon": 25652, + "name": "Raw Guppy", + "xp": 8 + }, { "level": 10, "icon": 345, @@ -48,6 +54,12 @@ "name": "Raw Trout", "xp": 50 }, + { + "level": 20, + "icon": 25658, + "name": "Raw Cavefish", + "xp": 16 + }, { "level": 23, "icon": 341, @@ -72,6 +84,12 @@ "name": "Raw Salmon", "xp": 70 }, + { + "level": 33, + "icon": 25664, + "name": "Raw Tetra", + "xp": 24 + }, { "level": 35, "icon": 359, @@ -102,6 +120,12 @@ "name": "Raw Bass", "xp": 100 }, + { + "level": 46, + "icon": 25670, + "name": "Raw Catfish", + "xp": 33 + }, { "level": 48, "icon": 11328, diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json index 728f204861..a944c4782f 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json @@ -36,6 +36,18 @@ "name": "Limestone", "xp": 26.5 }, + { + "level": 14, + "icon": 25683, + "name": "Barronite shards", + "xp": 16 + }, + { + "level": 14, + "icon": 25684, + "name": "Barronite deposit", + "xp": 32 + }, { "level": 15, "icon": 440, diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json index 8ef26c4797..9ebde37563 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json @@ -368,6 +368,30 @@ "icon": 25419, "name": "Urium Remains", "xp": 120 + }, + { + "level": 1, + "icon": 25654, + "name": "Guppy", + "xp": 4 + }, + { + "level": 1, + "icon": 25660, + "name": "Cavefish", + "xp": 7 + }, + { + "level": 1, + "icon": 25666, + "name": "Tetra", + "xp": 10 + }, + { + "level": 1, + "icon": 25672, + "name": "Cavefish", + "xp": 16 } ] } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json index 3e62d892f4..901196750e 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json @@ -102,6 +102,12 @@ "name": "Mind Rune", "xp": 5.5 }, + { + "level": 2, + "icon": 25696, + "name": "Mind core", + "xp": 55 + }, { "level": 5, "icon": 555, @@ -156,6 +162,12 @@ "name": "Body Rune", "xp": 7.5 }, + { + "level": 20, + "icon": 25698, + "name": "Body core", + "xp": 75 + }, { "level": 23, "icon": 4699, @@ -174,6 +186,12 @@ "name": "Chaos Rune", "xp": 8.5 }, + { + "level": 35, + "icon": 25700, + "name": "Chaos core", + "xp": 85 + }, { "level": 40, "icon": 9075, diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json index adce0a7faf..bf829f53b6 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json @@ -156,6 +156,12 @@ "name": "Bronze 2h Sword", "xp": 37.5 }, + { + "level": 14, + "icon": 25684, + "name": "Barronite deposits", + "xp": 30 + }, { "level": 15, "icon": 2351, From f06fee20a1e26da520d55ce76786533b8a2b10f2 Mon Sep 17 00:00:00 2001 From: pilino1234 Date: Tue, 31 Aug 2021 16:15:42 +0200 Subject: [PATCH 18/32] worldmap: Add mining spots in Ruins of Camdozaal --- .../runelite/client/plugins/worldmap/MiningSiteLocation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java index b683414722..85fef484b9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MiningSiteLocation.java @@ -61,6 +61,8 @@ enum MiningSiteLocation BLAST_MINE_WEST(new WorldPoint(1471, 3865, 0), new Rock(22, Ore.HARD_ROCK)), BRIMHAVEN_NORTH(new WorldPoint(2732, 3225, 0), new Rock(10, Ore.GOLD)), BRIMHAVEN_SOUTH_(new WorldPoint(2743, 3150, 0), new Rock(6, Ore.GOLD)), + CAMDOZAAL_MINES_EAST(new WorldPoint(2934, 5811, 0), new Rock(8, Ore.BARRONITE), new Rock(1, Ore.CLAY), new Rock(2, Ore.TIN), new Rock(1, Ore.COPPER)), + CAMDOZAAL_MINES_WEST(new WorldPoint(2914, 5811, 0), new Rock(10, Ore.BARRONITE), new Rock(2, Ore.COPPER), new Rock(2, Ore.CLAY), new Rock(1, Ore.TIN)), CENTRAL_FREMENIK_ISLES(new WorldPoint(2374, 3850, 0), new Rock(7, Ore.COAL), new Rock(1, Ore.RUNITE)), CITHAREDE_ABBEY(new WorldPoint(3400, 3170, 0), new Rock(3, Ore.IRON), new Rock (3, Ore.COAL)), COAL_TRUCKS(new WorldPoint(2580, 3484, 0), new Rock(18, Ore.COAL)), @@ -238,6 +240,7 @@ enum MiningSiteLocation TIN("Tin"), LIMESTONE("Limestone"), BLURITE("Blurite"), + BARRONITE("Barronite"), IRON("Iron"), ELEMENTAL("Elemental"), SILVER("Silver"), From dbc7d4049f8de8e0a7124eff2fc593498158466f Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 15 Jun 2021 17:24:20 -0400 Subject: [PATCH 19/32] ItemMapping: Add Tome of Water and Master Scroll Book --- .../src/main/java/net/runelite/client/game/ItemMapping.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java index a879164634..af2423a862 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java @@ -196,6 +196,7 @@ public enum ItemMapping ITEM_SANGUINESTI_STAFF(SANGUINESTI_STAFF_UNCHARGED, SANGUINESTI_STAFF, HOLY_SANGUINESTI_STAFF_UNCHARGED, HOLY_SANGUINESTI_STAFF), ITEM_SCYTHE_OF_VITUR(SCYTHE_OF_VITUR_UNCHARGED, SCYTHE_OF_VITUR, HOLY_SCYTHE_OF_VITUR_UNCHARGED, HOLY_SCYTHE_OF_VITUR, SANGUINE_SCYTHE_OF_VITUR_UNCHARGED, SANGUINE_SCYTHE_OF_VITUR), ITEM_TOME_OF_FIRE(TOME_OF_FIRE_EMPTY, TOME_OF_FIRE), + ITEM_TOME_OF_WATER(TOME_OF_WATER_EMPTY, TOME_OF_WATER), ITEM_CRAWS_BOW(CRAWS_BOW_U, CRAWS_BOW), ITEM_VIGGORAS_CHAINMACE(VIGGORAS_CHAINMACE_U, VIGGORAS_CHAINMACE), ITEM_THAMMARONS_SCEPTRE(THAMMARONS_SCEPTRE_U, THAMMARONS_SCEPTRE), @@ -255,6 +256,7 @@ public enum ItemMapping ITEM_VOLATILE_ORB(VOLATILE_ORB, VOLATILE_NIGHTMARE_STAFF), ITEM_NIGHTMARE_STAFF(NIGHTMARE_STAFF, ELDRITCH_NIGHTMARE_STAFF, HARMONISED_NIGHTMARE_STAFF, VOLATILE_NIGHTMARE_STAFF), ITEM_GHARZI_RAPIER(GHRAZI_RAPIER, HOLY_GHRAZI_RAPIER), + ITEM_MASTER_SCROLL_BOOK(MASTER_SCROLL_BOOK_EMPTY, MASTER_SCROLL_BOOK), // Trouver Parchment ITEM_TROUVER_PARCHMENT( From a3d33bee0d82868420028946cc8368157605118e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 2 Sep 2021 10:57:57 -0400 Subject: [PATCH 20/32] logback: add duplicate exception filter This only applies to marked logged messages for overlay rendering and event subscribers, which are common sources of exceptions in 3rd party plugins --- .../runelite/client/eventbus/EventBus.java | 6 +- .../client/ui/overlay/OverlayRenderer.java | 5 +- .../client/util/DeduplicationFilter.java | 96 +++++++++++++++++++ .../src/main/resources/logback.xml | 2 + 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/util/DeduplicationFilter.java diff --git a/runelite-client/src/main/java/net/runelite/client/eventbus/EventBus.java b/runelite-client/src/main/java/net/runelite/client/eventbus/EventBus.java index 7845c80956..ed51aabb6e 100644 --- a/runelite-client/src/main/java/net/runelite/client/eventbus/EventBus.java +++ b/runelite-client/src/main/java/net/runelite/client/eventbus/EventBus.java @@ -44,12 +44,16 @@ import lombok.RequiredArgsConstructor; import lombok.Value; import lombok.extern.slf4j.Slf4j; import net.runelite.client.util.ReflectUtil; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; @Slf4j @RequiredArgsConstructor @ThreadSafe public class EventBus { + private static final Marker DEDUPLICATE = MarkerFactory.getMarker("DEDUPLICATE"); + @Value public static class Subscriber { @@ -82,7 +86,7 @@ public class EventBus */ public EventBus() { - this((e) -> log.warn("Uncaught exception in event subscriber", e)); + this((e) -> log.warn(DEDUPLICATE, "Uncaught exception in event subscriber", e)); } /** diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java index 463e05725e..99b75c0255 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/OverlayRenderer.java @@ -67,11 +67,14 @@ import net.runelite.client.input.MouseManager; import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.JagexColors; import net.runelite.client.util.ColorUtil; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; @Singleton @Slf4j public class OverlayRenderer extends MouseAdapter implements KeyListener { + private static final Marker DEDUPLICATE = MarkerFactory.getMarker("DEDUPLICATE"); private static final int BORDER = 5; private static final int BORDER_TOP = BORDER + 15; private static final int PADDING = 2; @@ -748,7 +751,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener } catch (Exception ex) { - log.warn("Error during overlay rendering", ex); + log.warn(DEDUPLICATE, "Error during overlay rendering", ex); return; } diff --git a/runelite-client/src/main/java/net/runelite/client/util/DeduplicationFilter.java b/runelite-client/src/main/java/net/runelite/client/util/DeduplicationFilter.java new file mode 100644 index 0000000000..2b99a27e97 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/util/DeduplicationFilter.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2021, 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.util; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.turbo.TurboFilter; +import ch.qos.logback.core.spi.FilterReply; +import java.util.Deque; +import java.util.concurrent.ConcurrentLinkedDeque; +import lombok.EqualsAndHashCode; +import lombok.RequiredArgsConstructor; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; + +public class DeduplicationFilter extends TurboFilter +{ + private static final Marker deduplicateMarker = MarkerFactory.getMarker("DEDUPLICATE"); + private static final int CACHE_SIZE = 8; + private static final int DUPLICATE_LOG_COUNT = 1000; + + @RequiredArgsConstructor + @EqualsAndHashCode(exclude = {"count"}) + private static class LogException + { + private final String message; + private final StackTraceElement[] stackTraceElements; + private volatile int count; + } + + private final Deque cache = new ConcurrentLinkedDeque<>(); + + @Override + public void stop() + { + cache.clear(); + super.stop(); + } + + @Override + public FilterReply decide(Marker marker, Logger logger, Level level, String s, Object[] objects, Throwable throwable) + { + if (marker != deduplicateMarker || logger.isDebugEnabled() || throwable == null) + { + return FilterReply.NEUTRAL; + } + + LogException logException = new LogException(s, throwable.getStackTrace()); + for (LogException e : cache) + { + if (logException.equals(e)) + { + // this iinc is not atomic, but doesn't matter in practice + if (++e.count % DUPLICATE_LOG_COUNT == 0) + { + logger.warn("following log message logged " + DUPLICATE_LOG_COUNT + " times!"); + return FilterReply.NEUTRAL; + } + return FilterReply.DENY; + } + } + + synchronized (cache) + { + if (cache.size() >= CACHE_SIZE) + { + cache.pop(); + } + cache.push(logException); + } + + return FilterReply.NEUTRAL; + } +} diff --git a/runelite-client/src/main/resources/logback.xml b/runelite-client/src/main/resources/logback.xml index d3a5ffbcad..60152930ce 100644 --- a/runelite-client/src/main/resources/logback.xml +++ b/runelite-client/src/main/resources/logback.xml @@ -24,6 +24,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n From ef3622c05ae497d264d72330c9d5b5fc20906801 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 3 Sep 2021 13:21:32 -0400 Subject: [PATCH 21/32] api: flatten model uvs This drastically reduces the number of allocated float arrays on the heap just by flattening the uvs into a single array per model --- .../src/main/java/net/runelite/api/Model.java | 3 +-- .../client/plugins/gpu/SceneUploader.java | 21 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Model.java b/runelite-api/src/main/java/net/runelite/api/Model.java index 4e5332e2f2..441577caea 100644 --- a/runelite-api/src/main/java/net/runelite/api/Model.java +++ b/runelite-api/src/main/java/net/runelite/api/Model.java @@ -72,8 +72,7 @@ public interface Model extends Renderable short[] getFaceTextures(); - float[][] getFaceTextureUCoordinates(); - float[][] getFaceTextureVCoordinates(); + float[] getFaceTextureUVCoordinates(); void calculateExtreme(int orientation); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java index 548eca7589..675381053d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java @@ -389,8 +389,7 @@ class SceneUploader final short[] faceTextures = model.getFaceTextures(); final byte[] facePriorities = model.getFaceRenderPriorities(); - float[][] u = model.getFaceTextureUCoordinates(); - float[][] v = model.getFaceTextureVCoordinates(); + float[] uv = model.getFaceTextureUVCoordinates(); int len = 0; for (int face = 0; face < triangleCount; ++face) @@ -432,7 +431,7 @@ class SceneUploader if (faceTextures != null) { - pushUvForFace(faceTextures, u, v, face, uvBuffer); + pushUvForFace(faceTextures, uv, face, uvBuffer); } len += 3; @@ -559,11 +558,9 @@ class SceneUploader vertexBuffer.put(a, b, c, packedAlphaPriority | color3); - float[][] u = model.getFaceTextureUCoordinates(); - float[][] v = model.getFaceTextureVCoordinates(); if (padUvs || faceTextures != null) { - pushUvForFace(faceTextures, u, v, face, uvBuffer); + pushUvForFace(faceTextures, model.getFaceTextureUVCoordinates(), face, uvBuffer); } return 3; @@ -584,15 +581,15 @@ class SceneUploader return alpha | priority; } - private static void pushUvForFace(short[] faceTextures, float[][] u, float[][] v, int face, GpuFloatBuffer uvBuffer) + private static void pushUvForFace(short[] faceTextures, float[] uv, int face, GpuFloatBuffer uvBuffer) { - float[] uf, vf; - if (faceTextures != null && u != null && v != null && (uf = u[face]) != null && (vf = v[face]) != null) + if (faceTextures != null && faceTextures[face] != -1 && uv != null) { + int idx = face * 6; float texture = faceTextures[face] + 1f; - uvBuffer.put(texture, uf[0], vf[0], 0f); - uvBuffer.put(texture, uf[1], vf[1], 0f); - uvBuffer.put(texture, uf[2], vf[2], 0f); + uvBuffer.put(texture, uv[idx], uv[idx + 1], 0f); + uvBuffer.put(texture, uv[idx + 2], uv[idx + 3], 0f); + uvBuffer.put(texture, uv[idx + 4], uv[idx + 5], 0f); } else { From adf0d75be8636d44c4fd8d42994738b98d17ac41 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 4 Sep 2021 12:32:21 -0400 Subject: [PATCH 22/32] wiki: move icon to match vanilla position --- .../java/net/runelite/api/widgets/WidgetID.java | 1 + .../net/runelite/api/widgets/WidgetInfo.java | 1 + .../client/plugins/wiki/WikiPlugin.java | 17 ++++++++--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 097c456d14..0e657a6e79 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 @@ -358,6 +358,7 @@ public class WidgetID static final int RUN_ORB_TEXT = 24; static final int SPEC_ORB = 29; static final int WORLDMAP_ORB = 43; + static final int WIKI_BANNER_PARENT = 44; static final int WIKI_BANNER = 45; static final int WORLDMAP_OPTIONS = 48; } 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 52e5961559..1e20e0fdc6 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 @@ -181,6 +181,7 @@ public enum WidgetInfo MINIMAP_HEALTH_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.HEALTH_ORB), MINIMAP_SPEC_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_ORB), MINIMAP_WORLDMAP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB), + MINIMAP_WIKI_BANNER_PARENT(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WIKI_BANNER_PARENT), MINIMAP_WIKI_BANNER(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WIKI_BANNER), MINIMAP_WORLDMAP_OPTIONS(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_OPTIONS), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 0e57fb47f7..5e9af5396a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -118,13 +118,12 @@ public class WikiPlugin extends Plugin private void removeWidgets() { - - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) + Widget wikiBannerParent = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER_PARENT); + if (wikiBannerParent == null) { return; } - Widget[] children = minimapOrbs.getChildren(); + Widget[] children = wikiBannerParent.getChildren(); if (children == null || children.length < 1) { return; @@ -152,8 +151,8 @@ public class WikiPlugin extends Plugin private void addWidgets() { - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) + Widget wikiBannerParent = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER_PARENT); + if (wikiBannerParent == null) { return; } @@ -164,12 +163,12 @@ public class WikiPlugin extends Plugin vanilla.setHidden(true); } - icon = minimapOrbs.createChild(0, WidgetType.GRAPHIC); + icon = wikiBannerParent.createChild(0, WidgetType.GRAPHIC); icon.setSpriteId(SpriteID.WIKI_DESELECTED); icon.setOriginalX(0); icon.setOriginalY(0); - icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_BOTTOM); + icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); icon.setOriginalWidth(40); icon.setOriginalHeight(14); icon.setTargetVerb("Lookup"); From 48fda0dd9a4276c31c6cd53d1823eb2c5922d296 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Sun, 5 Sep 2021 14:05:42 +0200 Subject: [PATCH 23/32] project: deprecated code in mixin --- .../src/main/java/net/runelite/mixins/RSClientMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 1162e83edb..ceeaa0d32e 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1451,11 +1451,11 @@ public abstract class RSClientMixin implements RSClient "|MenuAction|: MenuOption={} MenuTarget={} Id={} Opcode={}/{} Param0={} Param1={} CanvasX={} CanvasY={}", menuOptionClicked.getMenuOption(), menuOptionClicked.getMenuTarget(), menuOptionClicked.getId(), menuOptionClicked.getMenuAction(), opcode + (decremented ? 2000 : 0), - menuOptionClicked.getActionParam(), menuOptionClicked.getWidgetId(), canvasX, canvasY + menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), canvasX, canvasY ); } - copy$menuAction(menuOptionClicked.getActionParam(), menuOptionClicked.getWidgetId(), + copy$menuAction(menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), menuOptionClicked.getMenuAction() == UNKNOWN ? opcode : menuOptionClicked.getMenuAction().getId(), menuOptionClicked.getId(), menuOptionClicked.getMenuOption(), menuOptionClicked.getMenuTarget(), canvasX, canvasY); From cdbb0a3aa7b8f69bc5dee9fea953ac0f57d037d6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 4 Sep 2021 16:29:46 -0400 Subject: [PATCH 24/32] api: make getCanvasTilePoly work on multi-tile npcs --- runelite-api/src/main/java/net/runelite/api/Actor.java | 2 +- .../runelite/client/plugins/agility/AgilityOverlay.java | 8 +------- .../client/plugins/npchighlight/NpcSceneOverlay.java | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 857fdc3720..3e53351626 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -283,7 +283,7 @@ public interface Actor extends Renderable void setSpotAnimFrame(int spotAnimFrame); /** - * Gets the canvas area of the current tile the actor is standing on. + * Gets the canvas area of the current tiles the actor is standing on. * * @return the current tile canvas area */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java index 7612c5b662..e1102c3b89 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java @@ -35,8 +35,6 @@ import java.util.Set; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; @@ -157,11 +155,7 @@ class AgilityOverlay extends Overlay Color color = config.sepulchreHighlightColor(); for (NPC npc : npcs) { - NPCComposition npcComposition = npc.getComposition(); - int size = npcComposition.getSize(); - LocalPoint lp = npc.getLocalLocation(); - - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); + Polygon tilePoly = npc.getCanvasTilePoly(); if (tilePoly != null) { OverlayUtil.renderPolygon(graphics, tilePoly, color); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java index 84e428918c..a13ef58ade 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java @@ -162,10 +162,7 @@ public class NpcSceneOverlay extends Overlay if (highlightedNpc.isTile()) { - int size = npcComposition.getSize(); - LocalPoint lp = actor.getLocalLocation(); - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - + Polygon tilePoly = actor.getCanvasTilePoly(); renderPoly(graphics, borderColor, fillColor, tilePoly); } From 2cdd1be7d801ff83322d85512d54f1072db2186f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 Sep 2021 15:38:31 -0400 Subject: [PATCH 25/32] pom: remove source/target configuration on maven-compiler-plugin On Java 11, which we require for building, the compiler accepts --release 8 and no longer requires -source or -target, so these are unnecessary --- http-service/pom.xml | 2 ++ pom.xml | 3 --- runelite-jshell/pom.xml | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/http-service/pom.xml b/http-service/pom.xml index 44cce1d7d5..f1bfb35dbd 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -167,6 +167,8 @@ org.apache.maven.plugins maven-compiler-plugin + 1.8 + 1.8 org.mapstruct diff --git a/pom.xml b/pom.xml index d487454096..768a7e582d 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,6 @@ UTF-8 1 - 1.8 8 1.18.20 @@ -183,8 +182,6 @@ org.apache.maven.plugins maven-compiler-plugin - ${java.version} - ${java.version} ${java.release} diff --git a/runelite-jshell/pom.xml b/runelite-jshell/pom.xml index fef62246a0..8f1bac35c7 100644 --- a/runelite-jshell/pom.xml +++ b/runelite-jshell/pom.xml @@ -73,8 +73,6 @@ org.apache.maven.plugins maven-compiler-plugin - 11 - 11 11 From 97095b41f8dc48d5cfa0064fc1d2b6847ad911aa Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 5 Sep 2021 15:39:13 -0400 Subject: [PATCH 26/32] ui: force heavyweight tooltips on macos Lightweight components do not render correctly over AWT canvases on MacOS. The popup factory API to override this is not available on 8, so add an 11-specific popup factory to override it by using a multi-release jar. --- pom.xml | 6 ++- runelite-client/pom.xml | 41 ++++++++++++++++++ .../client/util/MacOSPopupFactory.java | 34 +++++++++++++++ .../net/runelite/client/util/SwingUtil.java | 9 ++++ .../client/util/MacOSPopupFactory.java | 42 +++++++++++++++++++ 5 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java create mode 100644 runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java diff --git a/pom.xml b/pom.xml index 768a7e582d..c3118cd0c2 100644 --- a/pom.xml +++ b/pom.xml @@ -273,8 +273,10 @@ checkstyle.xml - - ${project.build.sourceDirectory} + + + ${project.build.sourceDirectory} + true diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index debecf5638..95aaedc980 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -302,6 +302,36 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + compile-java11 + + compile + + + 11 + + ${project.basedir}/src/main/java11 + + ${project.build.outputDirectory}/META-INF/versions/11 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + + org.apache.maven.plugins maven-resources-plugin @@ -385,6 +415,17 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + + + ${project.build.sourceDirectory} + ${project.basedir}/src/main/java11 + + + org.apache.maven.plugins maven-pmd-plugin diff --git a/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java b/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java new file mode 100644 index 0000000000..8e9f14551a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021, 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.util; + +import javax.swing.PopupFactory; + +/** + * Dummy popup factory for Java 8 + */ +class MacOSPopupFactory extends PopupFactory +{ +} diff --git a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java index 90723d9ade..828adfdadf 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java @@ -50,6 +50,7 @@ import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.LookAndFeel; +import javax.swing.PopupFactory; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.UIManager; @@ -109,6 +110,14 @@ public class SwingUtil try { UIManager.setLookAndFeel(laf); + + if (OSType.getOSType() == OSType.MacOS) + { + // On MacOS Substance doesn't install its own popup factory, and the default one uses lightweight + // components unless the Aqua LAF is used. Lightweight components do not render correctly over AWT + // canvases on MacOS - so replace the popup factory one with that forces heavy components. + PopupFactory.setSharedInstance(new MacOSPopupFactory()); + } } catch (UnsupportedLookAndFeelException ex) { diff --git a/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java b/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java new file mode 100644 index 0000000000..62a91abed8 --- /dev/null +++ b/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021, 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.util; + +import java.awt.Component; +import javax.swing.Popup; +import javax.swing.PopupFactory; + +/** + * Popup factory for Java 11 which forces heavyweight popups. Lightweight popups do not render correctly + * over AWT canvases on OSX. + */ +class MacOSPopupFactory extends PopupFactory +{ + @Override + protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException + { + return super.getPopup(owner, contents, x, y, true); + } +} \ No newline at end of file From 56d0aae57df25e8f8dd5c80e9bf69295996935cc Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Mon, 6 Sep 2021 17:53:37 +0000 Subject: [PATCH 27/32] Release 1.7.22 --- 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-jshell/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 6aca9ff8b5..e185f6e5e7 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index a109246dff..20e91982b1 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 1d100fd808..dbe732d473 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 7082c0f968..b6a2596559 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index f1bfb35dbd..1540bbf987 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 Web Service diff --git a/pom.xml b/pom.xml index c3118cd0c2..5a12755322 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.7.22 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 1b59559d98..e7b3e51f75 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 95aaedc980..75d616851c 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 client diff --git a/runelite-jshell/pom.xml b/runelite-jshell/pom.xml index 8f1bac35c7..6ddc589375 100644 --- a/runelite-jshell/pom.xml +++ b/runelite-jshell/pom.xml @@ -30,7 +30,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 jshell diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 393e17c640..9b100011bb 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22-SNAPSHOT + 1.7.22 script-assembler-plugin From cc3b6550a9cd934fd42439920416084f2da71f08 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Mon, 6 Sep 2021 17:53:41 +0000 Subject: [PATCH 28/32] Bump for 1.7.23-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-jshell/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index e185f6e5e7..89b1a08ee2 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 20e91982b1..214cd1d80d 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index dbe732d473..8f956d5b00 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index b6a2596559..aefdbbd4fd 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 1540bbf987..c1dcce0d8d 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 5a12755322..88a9a30635 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.7.22 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index e7b3e51f75..7481dd4542 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 75d616851c..c0920e1b48 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT client diff --git a/runelite-jshell/pom.xml b/runelite-jshell/pom.xml index 6ddc589375..496ddfcb65 100644 --- a/runelite-jshell/pom.xml +++ b/runelite-jshell/pom.xml @@ -30,7 +30,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT jshell diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 9b100011bb..8d7af90cb3 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.22 + 1.7.23-SNAPSHOT script-assembler-plugin From 3181022c832956e301d1c063d3b84619785c13cf Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 3 Sep 2021 13:21:32 -0400 Subject: [PATCH 29/32] api: flatten model uvs This drastically reduces the number of allocated float arrays on the heap just by flattening the uvs into a single array per model --- .../src/main/java/net/runelite/api/Model.java | 3 +-- .../client/plugins/gpu/SceneUploader.java | 21 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Model.java b/runelite-api/src/main/java/net/runelite/api/Model.java index dd3c8eb3b0..6830a97b69 100644 --- a/runelite-api/src/main/java/net/runelite/api/Model.java +++ b/runelite-api/src/main/java/net/runelite/api/Model.java @@ -90,8 +90,7 @@ public interface Model extends Renderable short[] getFaceTextures(); - float[][] getFaceTextureUCoordinates(); - float[][] getFaceTextureVCoordinates(); + float[] getFaceTextureUVCoordinates(); void calculateExtreme(int orientation); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java index 548eca7589..675381053d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java @@ -389,8 +389,7 @@ class SceneUploader final short[] faceTextures = model.getFaceTextures(); final byte[] facePriorities = model.getFaceRenderPriorities(); - float[][] u = model.getFaceTextureUCoordinates(); - float[][] v = model.getFaceTextureVCoordinates(); + float[] uv = model.getFaceTextureUVCoordinates(); int len = 0; for (int face = 0; face < triangleCount; ++face) @@ -432,7 +431,7 @@ class SceneUploader if (faceTextures != null) { - pushUvForFace(faceTextures, u, v, face, uvBuffer); + pushUvForFace(faceTextures, uv, face, uvBuffer); } len += 3; @@ -559,11 +558,9 @@ class SceneUploader vertexBuffer.put(a, b, c, packedAlphaPriority | color3); - float[][] u = model.getFaceTextureUCoordinates(); - float[][] v = model.getFaceTextureVCoordinates(); if (padUvs || faceTextures != null) { - pushUvForFace(faceTextures, u, v, face, uvBuffer); + pushUvForFace(faceTextures, model.getFaceTextureUVCoordinates(), face, uvBuffer); } return 3; @@ -584,15 +581,15 @@ class SceneUploader return alpha | priority; } - private static void pushUvForFace(short[] faceTextures, float[][] u, float[][] v, int face, GpuFloatBuffer uvBuffer) + private static void pushUvForFace(short[] faceTextures, float[] uv, int face, GpuFloatBuffer uvBuffer) { - float[] uf, vf; - if (faceTextures != null && u != null && v != null && (uf = u[face]) != null && (vf = v[face]) != null) + if (faceTextures != null && faceTextures[face] != -1 && uv != null) { + int idx = face * 6; float texture = faceTextures[face] + 1f; - uvBuffer.put(texture, uf[0], vf[0], 0f); - uvBuffer.put(texture, uf[1], vf[1], 0f); - uvBuffer.put(texture, uf[2], vf[2], 0f); + uvBuffer.put(texture, uv[idx], uv[idx + 1], 0f); + uvBuffer.put(texture, uv[idx + 2], uv[idx + 3], 0f); + uvBuffer.put(texture, uv[idx + 4], uv[idx + 5], 0f); } else { From 376e9648eaece3eb7d48b9c9daf22c454e40b4d4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 4 Sep 2021 12:32:21 -0400 Subject: [PATCH 30/32] wiki: move icon to match vanilla position --- .../java/net/runelite/api/widgets/WidgetID.java | 1 + .../net/runelite/api/widgets/WidgetInfo.java | 1 + .../client/plugins/wiki/WikiPlugin.java | 17 ++++++++--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index bc261ad235..9219be40ce 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 @@ -430,6 +430,7 @@ public class WidgetID static final int SPEC_ORB = 29; static final int SPEC_CLICKBOX = 31; static final int WORLDMAP_ORB = 43; + static final int WIKI_BANNER_PARENT = 44; static final int WIKI_BANNER = 45; static final int WORLDMAP_OPTIONS = 48; } 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 616da55b1f..c30aa6a517 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 @@ -182,6 +182,7 @@ public enum WidgetInfo MINIMAP_SPEC_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_ORB), MINIMAP_SPEC_CLICKBOX(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_CLICKBOX), MINIMAP_WORLDMAP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB), + MINIMAP_WIKI_BANNER_PARENT(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WIKI_BANNER_PARENT), MINIMAP_WIKI_BANNER(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WIKI_BANNER), MINIMAP_WORLDMAP_OPTIONS(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_OPTIONS), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java index 7354a5a7f0..589ebc9240 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java @@ -118,13 +118,12 @@ public class WikiPlugin extends Plugin private void removeWidgets() { - - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) + Widget wikiBannerParent = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER_PARENT); + if (wikiBannerParent == null) { return; } - Widget[] children = minimapOrbs.getChildren(); + Widget[] children = wikiBannerParent.getChildren(); if (children == null || children.length < 1) { return; @@ -152,8 +151,8 @@ public class WikiPlugin extends Plugin private void addWidgets() { - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) + Widget wikiBannerParent = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER_PARENT); + if (wikiBannerParent == null) { return; } @@ -164,12 +163,12 @@ public class WikiPlugin extends Plugin vanilla.setHidden(true); } - icon = minimapOrbs.createChild(0, WidgetType.GRAPHIC); + icon = wikiBannerParent.createChild(0, WidgetType.GRAPHIC); icon.setSpriteId(SpriteID.WIKI_DESELECTED); icon.setOriginalX(0); icon.setOriginalY(0); - icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_BOTTOM); + icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); + icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); icon.setOriginalWidth(40); icon.setOriginalHeight(14); icon.setTargetVerb("Lookup"); From 7b65292c12b24d8ef6c74b4830a784905ffeae52 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 4 Sep 2021 16:29:46 -0400 Subject: [PATCH 31/32] api: make getCanvasTilePoly work on multi-tile npcs --- runelite-api/src/main/java/net/runelite/api/Actor.java | 2 +- .../runelite/client/plugins/agility/AgilityOverlay.java | 8 +------- .../client/plugins/npchighlight/NpcSceneOverlay.java | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 5c93f47b78..fc70625f2f 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -295,7 +295,7 @@ public interface Actor extends Renderable, Locatable void setSpotAnimFrame(int spotAnimFrame); /** - * Gets the canvas area of the current tile the actor is standing on. + * Gets the canvas area of the current tiles the actor is standing on. * * @return the current tile canvas area */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java index d44863d2a1..6fd2f1245a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java @@ -35,8 +35,6 @@ import java.util.Set; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; @@ -157,11 +155,7 @@ class AgilityOverlay extends Overlay Color color = config.sepulchreHighlightColor(); for (NPC npc : npcs) { - NPCComposition npcComposition = npc.getComposition(); - int size = npcComposition.getSize(); - LocalPoint lp = npc.getLocalLocation(); - - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); + Polygon tilePoly = npc.getCanvasTilePoly(); if (tilePoly != null) { OverlayUtil.renderPolygon(graphics, tilePoly, color); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java index 84e428918c..a13ef58ade 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java @@ -162,10 +162,7 @@ public class NpcSceneOverlay extends Overlay if (highlightedNpc.isTile()) { - int size = npcComposition.getSize(); - LocalPoint lp = actor.getLocalLocation(); - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - + Polygon tilePoly = actor.getCanvasTilePoly(); renderPoly(graphics, borderColor, fillColor, tilePoly); } From c6d5bcfa79cfb67482d85e5f626f8ff2d13b5393 Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Sun, 5 Sep 2021 20:12:24 +0200 Subject: [PATCH 32/32] project: Mixins for recent changes --- .../plugins/agility/AgilityOverlay.java | 1 + .../client/util/MacOSPopupFactory.java | 34 ++++++++ .../net/runelite/client/util/SwingUtil.java | 9 +++ .../client/util/MacOSPopupFactory.java | 42 ++++++++++ .../net/runelite/mixins/RSModelDataMixin.java | 58 +++++++------- .../net/runelite/mixins/RSModelMixin.java | 77 ++++++------------- .../java/net/runelite/mixins/RSNPCMixin.java | 17 ++++ .../java/net/runelite/rs/api/RSModel.java | 7 +- 8 files changed, 156 insertions(+), 89 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java create mode 100644 runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java index 6fd2f1245a..78c9bec540 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java @@ -35,6 +35,7 @@ import java.util.Set; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.NPC; +import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; diff --git a/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java b/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java new file mode 100644 index 0000000000..8e9f14551a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/util/MacOSPopupFactory.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2021, 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.util; + +import javax.swing.PopupFactory; + +/** + * Dummy popup factory for Java 8 + */ +class MacOSPopupFactory extends PopupFactory +{ +} diff --git a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java index d5b5ebd65e..22e46213e2 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java @@ -51,6 +51,7 @@ import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.LookAndFeel; +import javax.swing.PopupFactory; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.UIManager; @@ -112,6 +113,14 @@ public class SwingUtil try { UIManager.setLookAndFeel(laf); + + if (OSType.getOSType() == OSType.MacOS) + { + // On MacOS Substance doesn't install its own popup factory, and the default one uses lightweight + // components unless the Aqua LAF is used. Lightweight components do not render correctly over AWT + // canvases on MacOS - so replace the popup factory one with that forces heavy components. + PopupFactory.setSharedInstance(new MacOSPopupFactory()); + } } catch (UnsupportedLookAndFeelException ex) { diff --git a/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java b/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java new file mode 100644 index 0000000000..62a91abed8 --- /dev/null +++ b/runelite-client/src/main/java11/net/runelite/client/util/MacOSPopupFactory.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021, 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.util; + +import java.awt.Component; +import javax.swing.Popup; +import javax.swing.PopupFactory; + +/** + * Popup factory for Java 11 which forces heavyweight popups. Lightweight popups do not render correctly + * over AWT canvases on OSX. + */ +class MacOSPopupFactory extends PopupFactory +{ + @Override + protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException + { + return super.getPopup(owner, contents, x, y, true); + } +} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelDataMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelDataMixin.java index 36a55fcdd4..40ade7bb30 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelDataMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelDataMixin.java @@ -41,10 +41,7 @@ public abstract class RSModelDataMixin implements RSModelData private static RSClient client; @Inject - private float[][] faceTextureUCoordinates; - - @Inject - private float[][] faceTextureVCoordinates; + private float[] faceTextureUVCoordinates; @Copy("toModel") @Replace("toModel") @@ -59,14 +56,13 @@ public abstract class RSModelDataMixin implements RSModelData return null; } - if (faceTextureUCoordinates == null) + if (faceTextureUVCoordinates == null) { computeTextureUVCoordinates(); } RSModel rsModel = (RSModel) model; - rsModel.setFaceTextureUCoordinates(faceTextureUCoordinates); - rsModel.setFaceTextureVCoordinates(faceTextureVCoordinates); + rsModel.setFaceTextureUVCoordinates(faceTextureUVCoordinates); return model; } @@ -94,40 +90,35 @@ public abstract class RSModelDataMixin implements RSModelData final byte[] textureCoords = getTextureCoords(); int faceCount = getTriangleFaceCount(); - this.faceTextureUCoordinates = new float[faceCount][]; - this.faceTextureVCoordinates = new float[faceCount][]; + float[] faceTextureUCoordinates = new float[faceCount * 6]; for (int i = 0; i < faceCount; i++) { int trianglePointX = trianglePointsX[i]; int trianglePointY = trianglePointsY[i]; int trianglePointZ = trianglePointsZ[i]; - int textureCoordinate = textureCoords != null && textureCoords[i] != -1 ? textureCoords[i] & 255 : -1; - short textureIdx; - textureIdx = faceTextures[i]; + short textureIdx = faceTextures[i]; if (textureIdx != -1) { - float[] u = new float[3]; - float[] v = new float[3]; - int triangleVertexIdx1; int triangleVertexIdx2; int triangleVertexIdx3; - if (textureCoordinate == -1) + if (textureCoords != null && textureCoords[i] != -1) + { + int textureCoordinate = textureCoords[i] & 255; + triangleVertexIdx1 = texTriangleX[textureCoordinate]; + triangleVertexIdx2 = texTriangleY[textureCoordinate]; + triangleVertexIdx3 = texTriangleZ[textureCoordinate]; + } + else { triangleVertexIdx1 = trianglePointX; triangleVertexIdx2 = trianglePointY; triangleVertexIdx3 = trianglePointZ; } - else - { - triangleVertexIdx1 = texTriangleX[textureCoordinate]; - triangleVertexIdx2 = texTriangleY[textureCoordinate]; - triangleVertexIdx3 = texTriangleZ[textureCoordinate]; - } float triangleX = (float) vertexPositionsX[triangleVertexIdx1]; float triangleY = (float) vertexPositionsY[triangleVertexIdx1]; @@ -157,22 +148,29 @@ public abstract class RSModelDataMixin implements RSModelData float f_902_ = f_885_ * f_898_ - f_886_ * f_897_; float f_903_ = 1.0F / (f_900_ * f_882_ + f_901_ * f_883_ + f_902_ * f_884_); - u[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_; - u[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_; - u[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_; + float u0 = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_; + float u1 = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_; + float u2 = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_; f_900_ = f_883_ * f_899_ - f_884_ * f_898_; f_901_ = f_884_ * f_897_ - f_882_ * f_899_; f_902_ = f_882_ * f_898_ - f_883_ * f_897_; f_903_ = 1.0F / (f_900_ * f_885_ + f_901_ * f_886_ + f_902_ * f_887_); - v[0] = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_; - v[1] = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_; - v[2] = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_; + float v0 = (f_900_ * f_888_ + f_901_ * f_889_ + f_902_ * f_890_) * f_903_; + float v1 = (f_900_ * f_891_ + f_901_ * f_892_ + f_902_ * f_893_) * f_903_; + float v2 = (f_900_ * f_894_ + f_901_ * f_895_ + f_902_ * f_896_) * f_903_; - this.faceTextureUCoordinates[i] = u; - this.faceTextureVCoordinates[i] = v; + int idx = i * 6; + faceTextureUCoordinates[idx] = u0; + faceTextureUCoordinates[idx + 1] = v0; + faceTextureUCoordinates[idx + 2] = u1; + faceTextureUCoordinates[idx + 3] = v1; + faceTextureUCoordinates[idx + 4] = u2; + faceTextureUCoordinates[idx + 5] = v2; } } + + this.faceTextureUVCoordinates = faceTextureUCoordinates; } } \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java index a81e8c6092..e3e41629e0 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java @@ -61,51 +61,36 @@ public abstract class RSModelMixin implements RSModel private int rl$uvBufferOffset; @Inject - private float[][] rl$faceTextureUCoordinates; - - @Inject - private float[][] rl$faceTextureVCoordinates; + private float[] rl$faceTextureUVCoordinates; @MethodHook(value = "", end = true) @Inject public void rl$init(RSModel[] models, int length) { - int count = 0; - for (int i = 0; i < length; ++i) + if (this.getFaceTextures() != null) { - RSModel model = models[i]; - if (model != null) + int count = this.getTrianglesCount(); + float[] uv = new float[count * 6]; + int idx = 0; + + for (int i = 0; i < length; ++i) { - count += model.getTrianglesCount(); - } - } - - float[][] u = new float[count][]; - float[][] v = new float[count][]; - int idx = 0; - - for (int i = 0; i < length; ++i) - { - RSModel model = models[i]; - if (model != null) - { - float[][] modelU = model.getFaceTextureUCoordinates(); - float[][] modelV = model.getFaceTextureVCoordinates(); - - for (int j = 0; j < model.getTrianglesCount(); ++j) + RSModel model = models[i]; + if (model != null) { - if (modelU != null && modelV != null) + float[] modelUV = model.getFaceTextureUVCoordinates(); + + if (modelUV != null) { - u[idx] = modelU[j]; - v[idx] = modelV[j]; + System.arraycopy(modelUV, 0, uv, idx, model.getTrianglesCount() * 6); } - ++idx; + + idx += model.getTrianglesCount() * 6; } } - } - setFaceTextureUCoordinates(u); - setFaceTextureVCoordinates(v); + setFaceTextureUVCoordinates(uv); + } } @Override @@ -169,8 +154,7 @@ public abstract class RSModelMixin implements RSModel if (model != null && model != this) { RSModel rsModel = (RSModel) model; - rsModel.setFaceTextureUCoordinates(rl$faceTextureUCoordinates); - rsModel.setFaceTextureVCoordinates(rl$faceTextureVCoordinates); + rsModel.setFaceTextureUVCoordinates(rl$faceTextureUVCoordinates); } return model; } @@ -192,8 +176,7 @@ public abstract class RSModelMixin implements RSModel { // Animated models are usually a shared Model instance that is global RSModel rsModel = (RSModel) sharedModel; - rsModel.setFaceTextureUCoordinates(rl$faceTextureUCoordinates); - rsModel.setFaceTextureVCoordinates(rl$faceTextureVCoordinates); + rsModel.setFaceTextureUVCoordinates(rl$faceTextureUVCoordinates); } @Inject @@ -385,29 +368,15 @@ public abstract class RSModelMixin implements RSModel @Inject @Override - public float[][] getFaceTextureUCoordinates() + public float[] getFaceTextureUVCoordinates() { - return rl$faceTextureUCoordinates; + return rl$faceTextureUVCoordinates; } @Inject @Override - public void setFaceTextureUCoordinates(float[][] faceTextureUCoordinates) + public void setFaceTextureUVCoordinates(float[] faceTextureUVCoordinates) { - this.rl$faceTextureUCoordinates = faceTextureUCoordinates; - } - - @Inject - @Override - public float[][] getFaceTextureVCoordinates() - { - return rl$faceTextureVCoordinates; - } - - @Inject - @Override - public void setFaceTextureVCoordinates(float[][] faceTextureVCoordinates) - { - this.rl$faceTextureVCoordinates = faceTextureVCoordinates; + this.rl$faceTextureUVCoordinates = faceTextureUVCoordinates; } } \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java index 0c47ce539a..aca1512718 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSNPCMixin.java @@ -24,6 +24,7 @@ */ package net.runelite.mixins; +import java.awt.Polygon; import java.awt.Shape; import net.runelite.api.AnimationID; import net.runelite.api.NPCComposition; @@ -169,6 +170,22 @@ public abstract class RSNPCMixin implements RSNPC return composition; } + @Inject + @Override + public Polygon getCanvasTilePoly() + { + NPCComposition transformedComposition = this.getTransformedComposition(); + if (transformedComposition == null) + { + return null; + } + else + { + int size = transformedComposition.getSize(); + return Perspective.getCanvasTileAreaPoly(client, this.getLocalLocation(), size); + } + } + @Inject @Override public Shape getConvexHull() diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java b/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java index bb17d2c718..8a3751d858 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java @@ -169,9 +169,6 @@ public interface RSModel extends RSRenderable, Model */ Shape getConvexHull(int localX, int localY, int orientation, int tileHeight); - float[][] getFaceTextureUCoordinates(); - void setFaceTextureUCoordinates(float[][] rl$faceTextureUCoordinates); - - float[][] getFaceTextureVCoordinates(); - void setFaceTextureVCoordinates(float[][] rl$faceTextureVCoordinates); + float[] getFaceTextureUVCoordinates(); + void setFaceTextureUVCoordinates(float[] rl$faceTextureUVCoordinates); }