Skip to content

Commit

Permalink
Merge pull request open-osrs#3008 from open-osrs/update-0707
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 authored Jul 7, 2021
2 parents dc27f11 + 27ee295 commit 5335653
Show file tree
Hide file tree
Showing 34 changed files with 311 additions and 94 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

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"
const val openosrsVersion = "4.9.5"

const val rsversion = 197
const val cacheversion = 165
Expand Down
4 changes: 2 additions & 2 deletions runelite-api/src/main/java/net/runelite/api/NpcID.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
35 changes: 20 additions & 15 deletions runelite-api/src/main/java/net/runelite/api/Perspective.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,37 +411,42 @@ public static Polygon getCanvasTileAreaPoly(
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);
if (!localLocation.isInScene())
{
return null;
}

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)
{
return null;
}

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)
{
Expand Down
14 changes: 12 additions & 2 deletions runelite-api/src/main/java/net/runelite/api/coords/LocalPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ public int distanceTo(LocalPoint other)
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.
*
Expand All @@ -117,7 +127,7 @@ public static LocalPoint fromScene(int x, int y)
*/
public int getSceneX()
{
return x >>> Perspective.LOCAL_COORD_BITS;
return x >> Perspective.LOCAL_COORD_BITS;
}

/**
Expand All @@ -127,6 +137,6 @@ public int getSceneX()
*/
public int getSceneY()
{
return y >>> Perspective.LOCAL_COORD_BITS;
return y >> Perspective.LOCAL_COORD_BITS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -189,8 +188,7 @@ static class WorldMap
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
Expand Down Expand Up @@ -431,6 +429,7 @@ static class Minimap
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
Expand Down Expand Up @@ -750,8 +749,8 @@ static class DialogSprite

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),

Expand Down
15 changes: 6 additions & 9 deletions runelite-client/src/main/java/net/runelite/client/Notifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,11 @@ private boolean tryLoadNotification()
{
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)
{
Expand All @@ -495,8 +492,8 @@ private boolean tryLoadNotification()
}

// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand Down Expand Up @@ -134,13 +135,12 @@ public BufferedImage downloadIcon(ExternalPluginManifest plugin) throws IOExcept

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand All @@ -49,12 +50,19 @@ public class ItemVariationMapping
static
{
final Gson gson = new Gson();
final TypeToken<Map<String, Collection<Integer>>> typeToken = new TypeToken<Map<String, Collection<Integer>>>()
{
};
// CHECKSTYLE:OFF
final TypeToken<Map<String, Collection<Integer>>> typeToken = new TypeToken<Map<String, Collection<Integer>>>(){};
// CHECKSTYLE:ON

final InputStream geLimitData = ItemVariationMapping.class.getResourceAsStream("/item_variations.json");
final Map<String, Collection<Integer>> itemVariations = gson.fromJson(new InputStreamReader(geLimitData, StandardCharsets.UTF_8), typeToken.getType());
final Map<String, Collection<Integer>> 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<Integer, Integer> builder = new ImmutableMap.Builder<>();
ImmutableMultimap.Builder<Integer, Integer> invertedBuilder = new ImmutableMultimap.Builder<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void onAnimationChanged(AnimationChanged e)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1738,12 +1738,22 @@ private static String longBossName(String boss)
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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ private CoordinateClueInfo(@Nonnull String directions, Enemy enemy, boolean ligh
.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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
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<Function<String, String>> resourceLoaders = new ArrayList<>();
Expand Down Expand Up @@ -80,10 +82,16 @@ public Template addInclude(Class<?> clazz)
{
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;
});
Expand Down
Loading

0 comments on commit 5335653

Please sign in to comment.