diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index fcf71fc44f..2f0145be36 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -25,7 +25,7 @@ object ProjectVersions { const val launcherVersion = "2.2.0" - const val rlVersion = "1.7.14.1" + const val rlVersion = "1.7.15" const val openosrsVersion = "4.9.4" diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 5ef310cdab..01479be017 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -7368,7 +7368,7 @@ public final class NpcID public static final int AMELIA = 8180; public static final int JONATHAN = 8181; public static final int NATURAL_HISTORIAN_8182 = 8182; - public static final int LITTLE_PARASAITE = 8183; + public static final int LITTLE_PARASITE = 8183; public static final int BOULDER_8188 = 8188; public static final int GRAVE_DIGGER = 8189; public static final int JAMES = 8193; @@ -7634,7 +7634,7 @@ public final class NpcID public static final int ELISE = 8538; public static final int ARC_TEST_01 = 8539; public static final int ARC_TEST_02 = 8540; - public static final int LITTLE_PARASITE = 8541; + public static final int LITTLE_PARASITE_8541 = 8541; public static final int ROYAL_GUARD = 8542; public static final int ROYAL_GUARD_8543 = 8543; public static final int UNDOR = 8544; diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index dad1deb05e..89d1fade1c 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -411,37 +411,42 @@ public class Perspective int plane, int zOffset) { - final int swX = localLocation.getX() - (sizeX * LOCAL_TILE_SIZE / 2); - final int swY = localLocation.getY() - (sizeY * LOCAL_TILE_SIZE / 2); - - final int neX = localLocation.getX() + (sizeX * LOCAL_TILE_SIZE / 2); - final int neY = localLocation.getY() + (sizeY * LOCAL_TILE_SIZE / 2); - - final byte[][][] tileSettings = client.getTileSettings(); - - final int sceneX = localLocation.getSceneX(); - final int sceneY = localLocation.getSceneY(); - - if (sceneX < 0 || sceneY < 0 || sceneX >= SCENE_SIZE || sceneY >= SCENE_SIZE) + if (!localLocation.isInScene()) { return null; } + final byte[][][] tileSettings = client.getTileSettings(); + final int sceneX = localLocation.getSceneX(); + final int sceneY = localLocation.getSceneY(); + int tilePlane = plane; if (plane < Constants.MAX_Z - 1 && (tileSettings[1][sceneX][sceneY] & TILE_FLAG_BRIDGE) == TILE_FLAG_BRIDGE) { tilePlane = plane + 1; } + final int swX = localLocation.getX() - (sizeX * LOCAL_TILE_SIZE / 2); + final int swY = localLocation.getY() - (sizeY * LOCAL_TILE_SIZE / 2); + + final int neX = localLocation.getX() + (sizeX * LOCAL_TILE_SIZE / 2); + final int neY = localLocation.getY() + (sizeY * LOCAL_TILE_SIZE / 2); + + final int seX = swX; + final int seY = neY; + + final int nwX = neX; + final int nwY = swY; + final int swHeight = getHeight(client, swX, swY, tilePlane) - zOffset; - final int nwHeight = getHeight(client, neX, swY, tilePlane) - zOffset; + final int nwHeight = getHeight(client, nwX, nwY, tilePlane) - zOffset; final int neHeight = getHeight(client, neX, neY, tilePlane) - zOffset; - final int seHeight = getHeight(client, swX, neY, tilePlane) - zOffset; + final int seHeight = getHeight(client, seX, seY, tilePlane) - zOffset; Point p1 = localToCanvas(client, swX, swY, swHeight); - Point p2 = localToCanvas(client, neX, swY, nwHeight); + Point p2 = localToCanvas(client, nwX, nwY, nwHeight); Point p3 = localToCanvas(client, neX, neY, neHeight); - Point p4 = localToCanvas(client, swX, neY, seHeight); + Point p4 = localToCanvas(client, seX, seY, seHeight); if (p1 == null || p2 == null || p3 == null || p4 == null) { diff --git a/runelite-api/src/main/java/net/runelite/api/coords/LocalPoint.java b/runelite-api/src/main/java/net/runelite/api/coords/LocalPoint.java index bf1c032426..acc562dc44 100644 --- a/runelite-api/src/main/java/net/runelite/api/coords/LocalPoint.java +++ b/runelite-api/src/main/java/net/runelite/api/coords/LocalPoint.java @@ -95,6 +95,16 @@ public class LocalPoint return (int) Math.hypot(getX() - other.getX(), getY() - other.getY()); } + /** + * Test if this point is in the loaded scene, a 104x104 tile area. + * @return + */ + public boolean isInScene() + { + return x >= 0 && x < Perspective.SCENE_SIZE << Perspective.LOCAL_COORD_BITS + && y >= 0 && y < Perspective.SCENE_SIZE << Perspective.LOCAL_COORD_BITS; + } + /** * Gets the coordinate at the center of the passed tile. * @@ -117,7 +127,7 @@ public class LocalPoint */ public int getSceneX() { - return x >>> Perspective.LOCAL_COORD_BITS; + return x >> Perspective.LOCAL_COORD_BITS; } /** @@ -127,6 +137,6 @@ public class LocalPoint */ public int getSceneY() { - return y >>> Perspective.LOCAL_COORD_BITS; + return y >> Perspective.LOCAL_COORD_BITS; } } diff --git a/runelite-api/src/main/java/net/runelite/api/overlay/OverlayIndex.java b/runelite-api/src/main/java/net/runelite/api/overlay/OverlayIndex.java index 6aec875181..9af2b6cc35 100644 --- a/runelite-api/src/main/java/net/runelite/api/overlay/OverlayIndex.java +++ b/runelite-api/src/main/java/net/runelite/api/overlay/OverlayIndex.java @@ -38,9 +38,8 @@ public class OverlayIndex static { - InputStream indexStream = OverlayIndex.class.getResourceAsStream("/runelite/index"); - - try (DataInputStream in = new DataInputStream(indexStream)) + try (InputStream indexStream = OverlayIndex.class.getResourceAsStream("/runelite/index"); + DataInputStream in = new DataInputStream(indexStream)) { int id; while ((id = in.readInt()) != -1) 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 c51074c30c..33872b4667 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 @@ -76,7 +76,6 @@ public class WidgetID public static final int SLAYER_REWARDS_GROUP_ID = 426; public static final int PRIVATE_CHAT = 163; public static final int CHATBOX_GROUP_ID = 162; - public static final int WORLD_MAP_MENU_GROUP_ID = 160; public static final int VOLCANIC_MINE_GROUP_ID = 611; public static final int BA_ATTACKER_GROUP_ID = 485; public static final int BA_COLLECTOR_GROUP_ID = 486; @@ -189,8 +188,7 @@ public class WidgetID static final int BOTTOM_BAR = 23; static final int SEARCH = 26; static final int SURFACE_SELECTOR = 34; - static final int TOOLTIP = 43; - static final int OPTION = 48; + static final int TOOLTIP = 41; } static class SlayerRewards @@ -431,6 +429,7 @@ public class WidgetID static final int SPEC_CLICKBOX = 31; static final int WORLDMAP_ORB = 43; static final int WIKI_BANNER = 45; + static final int WORLDMAP_OPTIONS = 48; } static class LoginClickToPlayScreen @@ -750,8 +749,8 @@ public class WidgetID static class ExperienceTracker { - static final int WIDGET = 3; - static final int BOTTOM_BAR = 15; + static final int WIDGET = 4; + static final int BOTTOM_BAR = 16; } static class FairyRingPanel 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 cb9391032e..8b3fcb0177 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 @@ -55,7 +55,6 @@ public enum WidgetInfo WORLD_MAP_SEARCH(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.SEARCH), WORLD_MAP_SURFACE_SELECTOR(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.SURFACE_SELECTOR), WORLD_MAP_TOOLTIP(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.TOOLTIP), - WORLD_MAP_OPTION(WidgetID.WORLD_MAP_MENU_GROUP_ID, WidgetID.WorldMap.OPTION), CLUE_SCROLL_TEXT(WidgetID.CLUE_SCROLL_GROUP_ID, WidgetID.Cluescroll.CLUE_TEXT), CLUE_SCROLL_REWARD_ITEM_CONTAINER(WidgetID.CLUE_SCROLL_REWARD_GROUP_ID, WidgetID.Cluescroll.CLUE_SCROLL_ITEM_CONTAINER), @@ -184,6 +183,7 @@ public enum WidgetInfo 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(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WIKI_BANNER), + MINIMAP_WORLDMAP_OPTIONS(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_OPTIONS), LMS_INFO(WidgetID.LMS_GROUP_ID, WidgetID.Lms.INFO), LMS_KDA(WidgetID.LMS_INGAME_GROUP_ID, WidgetID.LmsKDA.INFO), @@ -532,7 +532,7 @@ public enum WidgetInfo GAUNTLET_TIMER_CONTAINER(WidgetID.GAUNTLET_TIMER_GROUP_ID, WidgetID.GauntletTimer.CONTAINER), HALLOWED_SEPULCHRE_TIMER_CONTAINER(WidgetID.HALLOWED_SEPULCHRE_TIMER_GROUP_ID, WidgetID.HallowedSepulchreTimer.CONTAINER), - HEALTH_OVERLAY_BAR(WidgetID.HEALTH_OVERLAY_BAR_GROUP_ID, 4), + HEALTH_OVERLAY_BAR(WidgetID.HEALTH_OVERLAY_BAR_GROUP_ID, 5), TRAILBLAZER_AREA_TELEPORT(WidgetID.TRAILBLAZER_AREAS_GROUP_ID, WidgetID.TrailblazerAreas.TELEPORT), diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index e36c43626b..87a2fbfffc 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -479,14 +479,11 @@ public class Notifier { if (NOTIFICATION_FILE.exists()) { - try + try (InputStream fileStream = new BufferedInputStream(new FileInputStream(NOTIFICATION_FILE)); + AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream)) { - InputStream fileStream = new BufferedInputStream(new FileInputStream(NOTIFICATION_FILE)); - try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream)) - { - clip.open(sound); - return true; - } + clip.open(sound); + return true; } catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) { @@ -495,8 +492,8 @@ public class Notifier } // Otherwise load from the classpath - InputStream fileStream = new BufferedInputStream(Notifier.class.getResourceAsStream("notification.wav")); - try (AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream)) + try (InputStream fileStream = new BufferedInputStream(Notifier.class.getResourceAsStream("notification.wav")); + AudioInputStream sound = AudioSystem.getAudioInputStream(fileStream)) { clip.open(sound); return true; diff --git a/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java b/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java index ccf4b9fad3..d101cc22bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java +++ b/runelite-client/src/main/java/net/runelite/client/externalplugins/ExternalPluginClient.java @@ -30,6 +30,7 @@ import com.google.gson.JsonSyntaxException; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; @@ -134,13 +135,12 @@ public class ExternalPluginClient private static Certificate loadCertificate() { - try + try (InputStream in = ExternalPluginClient.class.getResourceAsStream("externalplugins.crt")) { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); - Certificate certificate = certFactory.generateCertificate(ExternalPluginClient.class.getResourceAsStream("externalplugins.crt")); - return certificate; + return certFactory.generateCertificate(in); } - catch (CertificateException e) + catch (CertificateException | IOException e) { throw new RuntimeException(e); } diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemVariationMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemVariationMapping.java index 5daec1aee9..2161bedba2 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemVariationMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemVariationMapping.java @@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; @@ -49,12 +50,19 @@ public class ItemVariationMapping static { final Gson gson = new Gson(); - final TypeToken>> typeToken = new TypeToken>>() - { - }; + // CHECKSTYLE:OFF + final TypeToken>> typeToken = new TypeToken>>(){}; + // CHECKSTYLE:ON - final InputStream geLimitData = ItemVariationMapping.class.getResourceAsStream("/item_variations.json"); - final Map> itemVariations = gson.fromJson(new InputStreamReader(geLimitData, StandardCharsets.UTF_8), typeToken.getType()); + final Map> itemVariations; + try (InputStream geLimitData = ItemVariationMapping.class.getResourceAsStream("/item_variations.json")) + { + itemVariations = gson.fromJson(new InputStreamReader(geLimitData, StandardCharsets.UTF_8), typeToken.getType()); + } + catch (IOException e) + { + throw new RuntimeException(e); + } ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); ImmutableMultimap.Builder invertedBuilder = new ImmutableMultimap.Builder<>(); diff --git a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java index 418e493738..124f7f8e94 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java @@ -237,7 +237,7 @@ public class LootManager public void onNpcChanged(NpcChanged npcChanged) { final NPC npc = npcChanged.getNpc(); - if (npc.getId() == NpcID.THE_NIGHTMARE_9433) + if (npc.getId() == NpcID.THE_NIGHTMARE_9433 || npc.getId() == NpcID.PHOSANIS_NIGHTMARE_9424) { delayedLootNpc = npc; delayedLootTickLimit = 15; 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 5e5f95d903..9a998e8aca 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,22 @@ public class ChatCommandsPlugin extends Plugin case "the corrupted gauntlet": return "Corrupted Gauntlet"; + // The Nightmare case "nm": case "tnm": case "nmare": case "the nightmare": return "Nightmare"; + // Phosani's Nightmare + case "pnm": + case "phosani": + case "phosanis": + case "phosani nm": + case "phosani nightmare": + case "phosanis nightmare": + return "Phosani's Nightmare"; + // Hallowed Sepulchre case "hs": case "sepulchre": diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java index 9b9cd45479..c2bc53909f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java @@ -44,7 +44,7 @@ public interface ChatNotificationsConfig extends Config position = 1, keyName = "highlightWordsString", name = "Highlight words", - description = "Highlights the following words in chat", + description = "Highlights the following words in chat, separated by commas", section = highlightLists ) default String highlightWordsString() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java index 137c058f94..56c4a846e9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java @@ -149,7 +149,7 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc new AnagramClue("TEN WIGS ON", "Wingstone", new WorldPoint(3389, 2877, 0), "Between Nardah & Agility Pyramid"), new AnagramClue("THEM CAL CAME", "Cam the Camel", new WorldPoint(3300, 3231, 0), "Just outside of the Duel Arena"), new AnagramClue("THICKNO", "Hickton", new WorldPoint(2822, 3442, 0), "Catherby fletching shop", "How many ranges are there in Catherby?", "2"), - new AnagramClue("TWENTY CURE IRON", "New recruit Tony", new WorldPoint(1503, 3553, 0), "Shayzien Graveyard"), + new AnagramClue("TWENTY CURE IRON", "New Recruit Tony", new WorldPoint(1503, 3553, 0), "Shayzien Graveyard"), new AnagramClue("UNLEASH NIGHT MIST", "Sigli the Huntsman", new WorldPoint(2660, 3654, 0), "Rellekka", "What is the combined slayer requirement of every monster in the slayer cave?", "302"), new AnagramClue("VESTE", "Steve", new WorldPoint(2432, 3423, 0), "Upstairs Wyvern Area or Stronghold Slayer Cave", "How many farming patches are there in Gnome stronghold?", "2"), new AnagramClue("VEIL VEDA", "Evil Dave", new WorldPoint(3079, 9892, 0), "Doris' basement, Edgeville", "What is 333 multiplied by 2?", "666"), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java index 5f4dfdcc16..58b98cd6cd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java @@ -171,6 +171,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati .put(new WorldPoint(3143, 3774, 0), new CoordinateClueInfo("In level 32 Wilderness, by the black chinchompa hunting area.", ZAMORAK_WIZARD)) .put(new WorldPoint(2992, 3941, 0), new CoordinateClueInfo("Wilderness Agility Course, past the log balance.", ZAMORAK_WIZARD)) .put(new WorldPoint(1410, 3611, 0), new CoordinateClueInfo("Lake Molch dock west of Shayzien Encampment.", SARADOMIN_WIZARD)) + .put(new WorldPoint(1409, 3483, 0), new CoordinateClueInfo("South of Shayziens' Wall.", SARADOMIN_WIZARD)) // Elite .put(new WorldPoint(2357, 3151, 0), new CoordinateClueInfo("Lletya.", ARMADYLEAN_OR_BANDOSIAN_GUARD)) .put(new WorldPoint(3587, 3180, 0), new CoordinateClueInfo("Meiyerditch.", ARMADYLEAN_OR_BANDOSIAN_GUARD)) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java index cd0c8036da..8c769e3a55 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java @@ -168,8 +168,8 @@ public enum HotColdLocation WILDERNESS_54(MASTER, new WorldPoint(2981, 3944, 0), WILDERNESS, "West of the Wilderness Agility Course, level 54 Wilderness.", BRASSICAN_MAGE), ZEAH_BLASTMINE_BANK(MASTER, new WorldPoint(1504, 3859, 0), ZEAH, "Next to the bank in the Lovakengj blast mine.", BRASSICAN_MAGE), ZEAH_BLASTMINE_NORTH(MASTER, new WorldPoint(1488, 3881, 0), ZEAH, "Northern part of the Lovakengj blast mine.", BRASSICAN_MAGE), - ZEAH_LOVAKITE_FURNACE(MASTER, new WorldPoint(1507, 3819, 0), ZEAH, "Next to the lovakite furnace in Lovakengj.", ANCIENT_WIZARDS), - ZEAH_LOVAKENGJ_MINE(MASTER, new WorldPoint(1477, 3778, 0), ZEAH, "Next to mithril rock in the Lovakengj mine.", ANCIENT_WIZARDS), + ZEAH_LOVAKITE_FURNACE(MASTER, new WorldPoint(1507, 3819, 0), ZEAH, "Next to the lovakite furnace in Lovakengj.", BRASSICAN_MAGE), + ZEAH_LOVAKENGJ_MINE(MASTER, new WorldPoint(1477, 3778, 0), ZEAH, "Next to mithril rock in the Lovakengj mine.", BRASSICAN_MAGE), ZEAH_SULPHR_MINE(MASTER, new WorldPoint(1428, 3869, 0), ZEAH, "Western entrance in the Lovakengj sulphur mine. Facemask or Slayer Helmet recommended.", BRASSICAN_MAGE), ZEAH_SHAYZIEN_BANK(MASTER, new WorldPoint(1498, 3627, 0), ZEAH, "South-east of the bank in Shayzien Encampment.", BRASSICAN_MAGE), ZEAH_OVERPASS(MASTER, new WorldPoint(1467, 3714, 0), ZEAH, "Overpass between Lovakengj and Shayzien.", BRASSICAN_MAGE), @@ -179,7 +179,7 @@ public enum HotColdLocation ZEAH_LIBRARY(MASTER, new WorldPoint(1603, 3843, 0), ZEAH, "North-west of the Arceuus Library.", BRASSICAN_MAGE), ZEAH_HOUSECHURCH(MASTER, new WorldPoint(1682, 3792, 0), ZEAH, "By the entrance to the Arceuus church.", ANCIENT_WIZARDS), ZEAH_DARK_ALTAR(MASTER, new WorldPoint(1698, 3881, 0), ZEAH, "West of the Dark Altar.", BRASSICAN_MAGE), - ZEAH_ARCEUUS_HOUSE(MASTER, new WorldPoint(1710, 3700, 0), ZEAH, "By the southern entrance to Arceuus.", ANCIENT_WIZARDS), + ZEAH_ARCEUUS_HOUSE(MASTER, new WorldPoint(1710, 3700, 0), ZEAH, "By the south-eastern entrance to Arceuus.", BRASSICAN_MAGE), ZEAH_ESSENCE_MINE(MASTER, new WorldPoint(1762, 3852, 0), ZEAH, "By the Arceuus essence mine.", BRASSICAN_MAGE), ZEAH_ESSENCE_MINE_NE(MASTER, new WorldPoint(1773, 3867, 0), ZEAH, "North-east of the Arceuus essence mine.", BRASSICAN_MAGE), ZEAH_PISCARILUS_MINE(MASTER, new WorldPoint(1768, 3705, 0), ZEAH, "South of the Piscarilius mine.", ANCIENT_WIZARDS), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java index 67ed68ca7f..22972a5e77 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java @@ -32,7 +32,9 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.function.Function; +import lombok.extern.slf4j.Slf4j; +@Slf4j public class Template { private final List> resourceLoaders = new ArrayList<>(); @@ -80,10 +82,16 @@ public class Template { return add(f -> { - InputStream is = clazz.getResourceAsStream(f); - if (is != null) + try (InputStream is = clazz.getResourceAsStream(f)) { - return inputStreamToString(is); + if (is != null) + { + return inputStreamToString(is); + } + } + catch (IOException ex) + { + log.warn(null, ex); } return null; }); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java index ff4be28f8a..d311a51319 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerSharingManager.java @@ -46,7 +46,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.events.WidgetMenuOptionClicked; -import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; +import static net.runelite.api.widgets.WidgetInfo.MINIMAP_WORLDMAP_OPTIONS; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.eventbus.Subscribe; @@ -57,9 +57,9 @@ import net.runelite.client.menus.WidgetMenuOption; @Slf4j class GroundMarkerSharingManager { - private static final WidgetMenuOption EXPORT_MARKERS_OPTION = new WidgetMenuOption("Export", "Ground Markers", WORLD_MAP_OPTION); - private static final WidgetMenuOption IMPORT_MARKERS_OPTION = new WidgetMenuOption("Import", "Ground Markers", WORLD_MAP_OPTION); - private static final WidgetMenuOption CLEAR_MARKERS_OPTION = new WidgetMenuOption("Clear", "Ground Markers", WORLD_MAP_OPTION); + private static final WidgetMenuOption EXPORT_MARKERS_OPTION = new WidgetMenuOption("Export", "Ground Markers", MINIMAP_WORLDMAP_OPTIONS); + private static final WidgetMenuOption IMPORT_MARKERS_OPTION = new WidgetMenuOption("Import", "Ground Markers", MINIMAP_WORLDMAP_OPTIONS); + private static final WidgetMenuOption CLEAR_MARKERS_OPTION = new WidgetMenuOption("Clear", "Ground Markers", MINIMAP_WORLDMAP_OPTIONS); private final GroundMarkerPlugin plugin; private final Client client; @@ -108,7 +108,7 @@ class GroundMarkerSharingManager public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) { // ensure that the option clicked is the export markers option - if (event.getWidget() != WORLD_MAP_OPTION) + if (event.getWidget() != MINIMAP_WORLDMAP_OPTIONS) { return; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java index 003a5bbc2e..f5cc4b6a51 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java @@ -28,7 +28,7 @@ import com.google.inject.Binder; import javax.inject.Inject; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.WidgetMenuOptionClicked; -import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; +import static net.runelite.api.widgets.WidgetInfo.MINIMAP_WORLDMAP_OPTIONS; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.input.KeyManager; import net.runelite.client.input.MouseManager; @@ -44,7 +44,7 @@ import net.runelite.client.ui.overlay.OverlayManager; ) public class InstanceMapPlugin extends Plugin { - private final WidgetMenuOption openMapOption = new WidgetMenuOption("Show", "Instance Map", WORLD_MAP_OPTION); + private final WidgetMenuOption openMapOption = new WidgetMenuOption("Show", "Instance Map", MINIMAP_WORLDMAP_OPTIONS); @Inject private InstanceMapInputListener inputListener; @@ -115,7 +115,7 @@ public class InstanceMapPlugin extends Plugin @Subscribe public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) { - if (event.getWidget() != WORLD_MAP_OPTION) + if (event.getWidget() != MINIMAP_WORLDMAP_OPTIONS) { return; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java index 2c3dc07102..7b32ff3489 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java @@ -55,4 +55,15 @@ public interface InventoryViewerConfig extends Config { return false; } + + @ConfigItem( + keyName = "hideIfInventoryActive", + name = "Hidden on inventory tab", + description = "Whether or not the overlay is hidden when the inventory tab is open.", + position = 2 + ) + default boolean hideIfInventoryActive() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java index 2896a9cf65..c5915d9693 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java @@ -35,6 +35,7 @@ import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemComposition; import net.runelite.api.ItemContainer; +import net.runelite.api.VarClientInt; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.overlay.OverlayPanel; import net.runelite.client.ui.overlay.OverlayPosition; @@ -49,6 +50,7 @@ class InventoryViewerOverlay extends OverlayPanel private final Client client; private final ItemManager itemManager; + private final InventoryViewerConfig config; private boolean hidden; @Inject @@ -61,6 +63,7 @@ class InventoryViewerOverlay extends OverlayPanel panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); this.itemManager = itemManager; this.client = client; + this.config = config; this.hidden = config.hiddenDefault(); } @@ -72,6 +75,11 @@ class InventoryViewerOverlay extends OverlayPanel return null; } + if (client.getVar(VarClientInt.INVENTORY_TAB) == 3 && config.hideIfInventoryActive()) + { + return null; + } + final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); if (itemContainer == null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java index 087eff54f6..a984549712 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.objectindicators; +import com.google.common.base.Strings; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; @@ -85,7 +86,10 @@ class ObjectIndicatorsOverlay extends Overlay // This is a multiloc composition = composition.getImpostor(); // Only mark the object if the name still matches - if (composition == null || !composition.getName().equals(colorTileObject.getName())) + if (composition == null + || Strings.isNullOrEmpty(composition.getName()) + || "null".equals(composition.getName()) + || !composition.getName().equals(colorTileObject.getName())) { continue; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java index 86a27c8915..5fe914b968 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java @@ -288,6 +288,18 @@ public class ObjectIndicatorsPlugin extends Plugin return; } + ObjectComposition objectComposition = client.getObjectDefinition(object.getId()); + if (objectComposition.getImpostorIds() == null) + { + // Multiloc names are instead checked in the overlay + String name = objectComposition.getName(); + if (Strings.isNullOrEmpty(name) || name.equals("null")) + { + // was marked, but name has changed + return; + } + } + for (ObjectPoint objectPoint : objectPoints) { if (worldPoint.getRegionX() == objectPoint.getRegionX() @@ -297,7 +309,7 @@ public class ObjectIndicatorsPlugin extends Plugin { log.debug("Marking object {} due to matching {}", object, objectPoint); objects.add(new ColorTileObject(object, - client.getObjectDefinition(object.getId()), + objectComposition, objectPoint.getName(), objectPoint.getColor())); break; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index f5a3871422..3cc468a39d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -872,7 +872,7 @@ public class RaidsPlugin extends Plugin @Override public void hotkeyPressed() { - screenshotScoutOverlay(); + clientThread.invoke(RaidsPlugin.this::screenshotScoutOverlay); } }; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java index 468e23a201..ecb90c6dab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java @@ -28,6 +28,7 @@ import com.google.inject.Inject; import com.google.inject.Provides; import java.awt.Color; import java.io.IOException; +import java.io.InputStream; import net.runelite.api.Client; import net.runelite.api.Constants; import net.runelite.api.GameState; @@ -59,7 +60,10 @@ public class SkyboxPlugin extends Plugin @Override public void startUp() throws IOException { - skybox = new Skybox(SkyboxPlugin.class.getResourceAsStream("skybox.txt"), "skybox.txt"); + try (InputStream in = SkyboxPlugin.class.getResourceAsStream("skybox.txt")) + { + skybox = new Skybox(in, "skybox.txt"); + } } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java index 398ee8eb94..63b7f61331 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java @@ -260,6 +260,12 @@ public class WintertodtPlugin extends Plugin MessageNode messageNode = chatMessage.getMessageNode(); final WintertodtInterruptType interruptType; + if (messageNode.getValue().startsWith("You carefully fletch the root")) + { + setActivity(WintertodtActivity.FLETCHING); + return; + } + if (messageNode.getValue().startsWith("The cold of")) { interruptType = WintertodtInterruptType.COLD; 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 af9c35fa53..ea65fd3468 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 @@ -278,7 +278,7 @@ class XpInfoBox extends JPanel { final List positions = new ArrayList<>(); - for (int level = xpSnapshotSingle.getStartLevel() + 1; level < xpSnapshotSingle.getEndLevel(); level++) + for (int level = xpSnapshotSingle.getStartLevel() + 1; level <= xpSnapshotSingle.getEndLevel(); level++) { double relativeStartExperience = Experience.getXpForLevel(level) - xpSnapshotSingle.getStartGoalXp(); double relativeEndExperience = xpSnapshotSingle.getEndGoalXp() - xpSnapshotSingle.getStartGoalXp(); diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index d130f3d8ce..091188c985 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -614,13 +614,13 @@ public class ClientLoader implements Supplier private static Certificate[] getJagexCertificateChain() { - try + try (InputStream in = ClientLoader.class.getResourceAsStream("jagex.crt")) { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt")); + Collection certificates = certificateFactory.generateCertificates(in); return certificates.toArray(new Certificate[0]); } - catch (CertificateException e) + catch (CertificateException | IOException e) { throw new RuntimeException("Unable to parse pinned certificates", e); } diff --git a/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java b/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java index 5305506a41..0921ab6975 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/FontManager.java @@ -28,6 +28,7 @@ import java.awt.Font; import java.awt.FontFormatException; import java.awt.GraphicsEnvironment; import java.io.IOException; +import java.io.InputStream; import javax.swing.text.StyleContext; import lombok.Getter; @@ -48,10 +49,12 @@ public class FontManager { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - try + try (InputStream inRunescape = FontManager.class.getResourceAsStream("runescape.ttf"); + InputStream inRunescapeSmall = FontManager.class.getResourceAsStream("runescape_small.ttf"); + InputStream inRunescapeBold = FontManager.class.getResourceAsStream("runescape_bold.ttf")) { - Font font = Font.createFont(Font.TRUETYPE_FONT, - FontManager.class.getResourceAsStream("runescape.ttf")) + // runescape + Font font = Font.createFont(Font.TRUETYPE_FONT, inRunescape) .deriveFont(Font.PLAIN, 16); ge.registerFont(font); @@ -59,8 +62,8 @@ public class FontManager .getFont(font.getName(), Font.PLAIN, 16); ge.registerFont(runescapeFont); - Font smallFont = Font.createFont(Font.TRUETYPE_FONT, - FontManager.class.getResourceAsStream("runescape_small.ttf")) + // small + Font smallFont = Font.createFont(Font.TRUETYPE_FONT, inRunescapeSmall) .deriveFont(Font.PLAIN, 16); ge.registerFont(smallFont); @@ -68,8 +71,8 @@ public class FontManager .getFont(smallFont.getName(), Font.PLAIN, 16); ge.registerFont(runescapeSmallFont); - Font boldFont = Font.createFont(Font.TRUETYPE_FONT, - FontManager.class.getResourceAsStream("runescape_bold.ttf")) + // bold + Font boldFont = Font.createFont(Font.TRUETYPE_FONT, inRunescapeBold) .deriveFont(Font.BOLD, 16); ge.registerFont(boldFont); diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java index 6481321bc2..1b3f98f22e 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java @@ -36,6 +36,7 @@ import java.awt.image.PixelGrabber; import java.awt.image.RescaleOp; import java.awt.image.WritableRaster; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -384,11 +385,11 @@ public class ImageUtil */ public static BufferedImage loadImageResource(final Class c, final String path) { - try + try (InputStream in = c.getResourceAsStream(path)) { synchronized (ImageIO.class) { - return ImageIO.read(c.getResourceAsStream(path)); + return ImageIO.read(in); } } catch (IllegalArgumentException e) diff --git a/runelite-client/src/main/java/net/runelite/client/util/ReflectUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ReflectUtil.java index fbcc28d28d..78bd1262bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ReflectUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ReflectUtil.java @@ -27,6 +27,7 @@ package net.runelite.client.util; import com.google.common.io.ByteStreams; import java.io.IOException; +import java.io.InputStream; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -104,10 +105,10 @@ public class ReflectUtil */ public static void installLookupHelper(PrivateLookupableClassLoader cl) { - try + String name = PrivateLookupHelper.class.getName(); + try (InputStream in = ReflectUtil.class.getResourceAsStream("/" + name.replace('.', '/') + ".class")) { - String name = PrivateLookupHelper.class.getName(); - byte[] classData = ByteStreams.toByteArray(ReflectUtil.class.getResourceAsStream("/" + name.replace('.', '/') + ".class")); + byte[] classData = ByteStreams.toByteArray(in); Class clazz = cl.defineClass0(name, classData, 0, classData.length); // force to run diff --git a/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java b/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java index 891170ca48..30ca3dfeda 100644 --- a/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/menus/MenuManagerTest.java @@ -34,7 +34,7 @@ import static net.runelite.api.MenuAction.CC_OP; import static net.runelite.api.MenuAction.RUNELITE; import net.runelite.api.MenuEntry; import net.runelite.api.events.MenuEntryAdded; -import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; +import static net.runelite.api.widgets.WidgetInfo.MINIMAP_WORLDMAP_OPTIONS; import net.runelite.client.util.Text; import static org.junit.Assert.assertArrayEquals; import org.junit.Before; @@ -70,7 +70,7 @@ public class MenuManagerTest { CANCEL.setOption("Cancel"); CANCEL.setType(MenuAction.CANCEL.getId()); - CANCEL.setParam1(WORLD_MAP_OPTION.getPackedId()); + CANCEL.setParam1(MINIMAP_WORLDMAP_OPTIONS.getPackedId()); } @Before @@ -94,19 +94,19 @@ public class MenuManagerTest final MenuEntry third = new MenuEntry(); first.setOption("Test"); first.setTarget("First Entry"); - first.setParam1(WORLD_MAP_OPTION.getPackedId()); + first.setParam1(MINIMAP_WORLDMAP_OPTIONS.getPackedId()); first.setType(RUNELITE.getId()); second.setOption("Test"); second.setTarget("Second Entry"); - second.setParam1(WORLD_MAP_OPTION.getPackedId()); + second.setParam1(MINIMAP_WORLDMAP_OPTIONS.getPackedId()); second.setType(RUNELITE.getId()); third.setOption("Test"); third.setTarget("Third Entry"); - third.setParam1(WORLD_MAP_OPTION.getPackedId()); + third.setParam1(MINIMAP_WORLDMAP_OPTIONS.getPackedId()); third.setType(RUNELITE.getId()); - menuManager.addManagedCustomMenu(new WidgetMenuOption(first.getOption(), first.getTarget(), WORLD_MAP_OPTION)); - menuManager.addManagedCustomMenu(new WidgetMenuOption(second.getOption(), second.getTarget(), WORLD_MAP_OPTION)); - menuManager.addManagedCustomMenu(new WidgetMenuOption(third.getOption(), third.getTarget(), WORLD_MAP_OPTION)); + menuManager.addManagedCustomMenu(new WidgetMenuOption(first.getOption(), first.getTarget(), MINIMAP_WORLDMAP_OPTIONS)); + menuManager.addManagedCustomMenu(new WidgetMenuOption(second.getOption(), second.getTarget(), MINIMAP_WORLDMAP_OPTIONS)); + menuManager.addManagedCustomMenu(new WidgetMenuOption(third.getOption(), third.getTarget(), MINIMAP_WORLDMAP_OPTIONS)); menuManager.onMenuEntryAdded(new MenuEntryAdded( CANCEL.getOption(), diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java new file mode 100644 index 0000000000..609fab93d0 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2019 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.skybox; + +import com.google.common.base.Strings; +import com.google.common.io.CharSource; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import javax.imageio.ImageIO; +import lombok.extern.slf4j.Slf4j; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +@Slf4j +@RunWith(MockitoJUnitRunner.class) +public class SkyboxTest +{ + @Test + public void testLoadSimple() throws IOException + { + Skybox skybox = new Skybox(CharSource.wrap("bounds 0 0 100 100 #00F // R 0 0 100 100\r\nr 99 99").openStream(), "simple"); + Assert.assertEquals(0, skybox.getColorForPoint(0, 0, 0, 0, 0, 1, null)); + int x = (99 * 64) + 32; + int y = (99 * 64) + 32; + Assert.assertEquals(0x0000FF, skybox.getColorForPoint(x, y, x, y, 0, 1, null)); + } + + @Test + public void testLoadActual() throws IOException + { + long start; + Skybox skybox; + try (InputStream in = SkyboxPlugin.class.getResourceAsStream("skybox.txt")) + { + start = System.nanoTime(); + skybox = new Skybox(in, "skybox.txt"); + } + log.info("Parse took {}ms", (System.nanoTime() - start) / 1_000_000); + + String skyboxFile = System.getProperty("skyboxExport"); + if (!Strings.isNullOrEmpty(skyboxFile)) + { + start = System.nanoTime(); + BufferedImage img = skybox.render(1f, 0, 0, null); + long time = System.nanoTime() - start; + log.info("Map render took {}ms", time / 1_000_000); + log.info("Single render takes ~{}ns/frame", time / (img.getWidth() * img.getHeight())); + ImageIO.write(img, "png", new File(skyboxFile)); + } + + Assert.assertNotEquals(skybox.getColorForPoint(3232, 3232, 3232, 3232, 0, .9, null), 0); // Lumbridge will never be black + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java new file mode 100644 index 0000000000..bf6ef2c603 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2018, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.worldmap; + +import java.io.IOException; +import java.io.InputStream; +import static org.junit.Assert.assertNotNull; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class TeleportLocationDataTest +{ + @Test + public void testResources() throws IOException + { + for (TeleportLocationData data : TeleportLocationData.values()) + { + String path = data.getIconPath(); + assertNotNull(path); + try (InputStream in = getClass().getResourceAsStream(path)) + { + assertNotNull(in); + } + } + } +} \ No newline at end of file