Make ObjectClueScroll extend LocationClueScroll
To force requirement of having location for every object ID, make object clue scrolls always extend location clue scrolls. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -215,34 +215,32 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
|
|
||||||
if (clue instanceof ObjectClueScroll)
|
if (clue instanceof ObjectClueScroll)
|
||||||
{
|
{
|
||||||
int objectId = ((ObjectClueScroll) clue).getObjectId();
|
final ObjectClueScroll objectClueScroll = (ObjectClueScroll) clue;
|
||||||
|
int objectId = objectClueScroll.getObjectId();
|
||||||
|
|
||||||
if (objectId != -1)
|
if (objectId != -1)
|
||||||
{
|
{
|
||||||
if (clue instanceof LocationClueScroll)
|
// Match object with location every time
|
||||||
|
final WorldPoint location = objectClueScroll.getLocation();
|
||||||
|
|
||||||
|
if (location != null)
|
||||||
{
|
{
|
||||||
// Match object with location every time
|
final LocalPoint localLocation = LocalPoint.fromWorld(client, location);
|
||||||
final WorldPoint location = ((LocationClueScroll) clue).getLocation();
|
|
||||||
|
|
||||||
if (location != null)
|
if (localLocation != null)
|
||||||
{
|
{
|
||||||
final LocalPoint localLocation = LocalPoint.fromWorld(client, location);
|
final Region region = client.getRegion();
|
||||||
|
final Tile[][][] tiles = region.getTiles();
|
||||||
|
final Tile tile = tiles[client.getPlane()][localLocation.getRegionX()][localLocation.getRegionY()];
|
||||||
|
|
||||||
if (localLocation != null)
|
objectsToMark = Arrays.stream(tile.getGameObjects())
|
||||||
|
.filter(object -> object != null && object.getId() == objectId)
|
||||||
|
.toArray(GameObject[]::new);
|
||||||
|
|
||||||
|
// Set hint arrow to first object found as there can only be 1 hint arrow
|
||||||
|
if (objectsToMark.length >= 1)
|
||||||
{
|
{
|
||||||
final Region region = client.getRegion();
|
client.setHintArrow(objectsToMark[0].getWorldLocation());
|
||||||
final Tile[][][] tiles = region.getTiles();
|
|
||||||
final Tile tile = tiles[client.getPlane()][localLocation.getRegionX()][localLocation.getRegionY()];
|
|
||||||
|
|
||||||
objectsToMark = Arrays.stream(tile.getGameObjects())
|
|
||||||
.filter(object -> object != null && object.getId() == objectId)
|
|
||||||
.toArray(GameObject[]::new);
|
|
||||||
|
|
||||||
// Set hint arrow to first object found as there can only be 1 hint arrow
|
|
||||||
if (objectsToMark.length >= 1)
|
|
||||||
{
|
|
||||||
client.setHintArrow(objectsToMark[0].getWorldLocation());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMA
|
|||||||
import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.SPADE_IMAGE;
|
import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.SPADE_IMAGE;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll, LocationClueScroll
|
public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll
|
||||||
{
|
{
|
||||||
private static final Set<CrypticClue> CLUES = ImmutableSet.of(
|
private static final Set<CrypticClue> CLUES = ImmutableSet.of(
|
||||||
new CrypticClue("Show this to Sherlock.", "Sherlock", new WorldPoint(2733, 3415, 0), "Sherlock is located to the east of the Sorcerer's tower in Seers' Village."),
|
new CrypticClue("Show this to Sherlock.", "Sherlock", new WorldPoint(2733, 3415, 0), "Sherlock is located to the east of the Sorcerer's tower in Seers' Village."),
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
|||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class MapClue extends ClueScroll implements ObjectClueScroll, LocationClueScroll
|
public class MapClue extends ClueScroll implements ObjectClueScroll
|
||||||
{
|
{
|
||||||
private static final Set<MapClue> CLUES = ImmutableSet.of(
|
private static final Set<MapClue> CLUES = ImmutableSet.of(
|
||||||
new MapClue(CLUE_SCROLL_EASY_12179, new WorldPoint(3300, 3291, 0)),
|
new MapClue(CLUE_SCROLL_EASY_12179, new WorldPoint(3300, 3291, 0)),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.cluescrolls.clues;
|
package net.runelite.client.plugins.cluescrolls.clues;
|
||||||
|
|
||||||
public interface ObjectClueScroll
|
public interface ObjectClueScroll extends LocationClueScroll
|
||||||
{
|
{
|
||||||
int getObjectId();
|
int getObjectId();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user