Search in sources :

Example 1 with EmoteClue

use of net.runelite.client.plugins.cluescrolls.clues.EmoteClue in project runelite by runelite.

the class ClueScrollEmoteOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    ClueScroll clue = plugin.getClue();
    if (clue == null || !(clue instanceof EmoteClue)) {
        return null;
    }
    EmoteClue emoteClue = (EmoteClue) clue;
    if (!emoteClue.getFirstEmote().hasSprite()) {
        return null;
    }
    Widget emoteContainer = client.getWidget(WidgetInfo.EMOTE_CONTAINER);
    if (emoteContainer == null || emoteContainer.isHidden()) {
        return null;
    }
    Widget emoteWindow = client.getWidget(WidgetInfo.EMOTE_WINDOW);
    if (emoteWindow == null) {
        return null;
    }
    for (Widget emoteWidget : emoteContainer.getDynamicChildren()) {
        if (emoteWidget.getSpriteId() == emoteClue.getFirstEmote().getSpriteId()) {
            highlightWidget(graphics, emoteWindow, emoteWidget, emoteClue.getSecondEmote() != null ? "1st" : "");
        } else if (emoteClue.getSecondEmote() != null && emoteWidget.getSpriteId() == emoteClue.getSecondEmote().getSpriteId()) {
            highlightWidget(graphics, emoteWindow, emoteWidget, "2nd");
        }
    }
    return null;
}
Also used : EmoteClue(net.runelite.client.plugins.cluescrolls.clues.EmoteClue) ClueScroll(net.runelite.client.plugins.cluescrolls.clues.ClueScroll) Widget(net.runelite.api.widgets.Widget)

Example 2 with EmoteClue

use of net.runelite.client.plugins.cluescrolls.clues.EmoteClue in project runelite by runelite.

the class ClueScrollPlugin method checkForClues.

@Schedule(period = 600, unit = ChronoUnit.MILLIS)
public void checkForClues() {
    if (client.getGameState() == GameState.LOGIN_SCREEN) {
        clue = null;
        return;
    }
    npcsToMark = null;
    objectsToMark = null;
    equippedItems = null;
    if (clue instanceof NpcClueScroll) {
        String npc = ((NpcClueScroll) clue).getNpc();
        if (npc != null) {
            Query query = new NPCQuery().nameContains(npc);
            npcsToMark = queryRunner.runQuery(query);
        }
    }
    if (clue instanceof ObjectClueScroll) {
        int objectId = ((ObjectClueScroll) clue).getObjectId();
        if (objectId != -1) {
            GameObjectQuery query = new GameObjectQuery().idEquals(objectId);
            objectsToMark = queryRunner.runQuery(query);
        }
    }
    if (clue instanceof EmoteClue) {
        equippedItems = new HashSet<>();
        Item[] result = queryRunner.runQuery(new InventoryItemQuery(InventoryID.EQUIPMENT));
        if (result != null) {
            for (Item item : result) {
                equippedItems.add(item.getId());
            }
        }
    }
    ClueScroll clue = findClueScroll();
    if (clue == null && this.clue != null) {
        // wait for WAIT_DURATION before discarding the knowledge of the player having a clue.
        if (Instant.now().compareTo(clueTimeout.plus(WAIT_DURATION)) < 0) {
            return;
        }
    }
    // so the clue window doesn't have to be open.
    if (clue != null) {
        this.clue = clue;
        this.clueTimeout = Instant.now();
    }
}
Also used : InventoryItemQuery(net.runelite.api.queries.InventoryItemQuery) NPCQuery(net.runelite.api.queries.NPCQuery) Query(net.runelite.api.Query) GameObjectQuery(net.runelite.api.queries.GameObjectQuery) TextClueScroll(net.runelite.client.plugins.cluescrolls.clues.TextClueScroll) ClueScroll(net.runelite.client.plugins.cluescrolls.clues.ClueScroll) NpcClueScroll(net.runelite.client.plugins.cluescrolls.clues.NpcClueScroll) ObjectClueScroll(net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll) NPCQuery(net.runelite.api.queries.NPCQuery) InventoryItemQuery(net.runelite.api.queries.InventoryItemQuery) WorldPoint(net.runelite.api.coords.WorldPoint) NpcClueScroll(net.runelite.client.plugins.cluescrolls.clues.NpcClueScroll) Item(net.runelite.api.Item) EmoteClue(net.runelite.client.plugins.cluescrolls.clues.EmoteClue) ObjectClueScroll(net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll) GameObjectQuery(net.runelite.api.queries.GameObjectQuery) Schedule(net.runelite.client.task.Schedule)

Example 3 with EmoteClue

use of net.runelite.client.plugins.cluescrolls.clues.EmoteClue in project runelite by runelite.

the class ClueScrollPlugin method findClueScroll.

private ClueScroll findClueScroll() {
    Widget clueScrollText = client.getWidget(WidgetInfo.CLUE_SCROLL_TEXT);
    if (clueScrollText != null) {
        // Remove line breaks and also the rare occasion where there are double line breaks
        String text = clueScrollText.getText().replaceAll("-<br>", "-").replaceAll("<br>", " ").replaceAll("[ ]+", " ").toLowerCase();
        if (clue != null && clue instanceof TextClueScroll) {
            if (((TextClueScroll) clue).getText().equalsIgnoreCase(text)) {
                return clue;
            }
        }
        if (text.startsWith("this anagram reveals who to speak to next:")) {
            return AnagramClue.forText(text);
        } else if (text.startsWith("the cipher reveals who to speak to next:")) {
            return CipherClue.forText(text);
        } else if (text.contains("degrees") && text.contains("minutes")) {
            return coordinatesToWorldPoint(text);
        } else {
            CrypticClue crypticClue = CrypticClue.forText(text);
            if (crypticClue != null) {
                return crypticClue;
            }
            EmoteClue emoteClue = EmoteClue.forText(text);
            if (emoteClue != null) {
                return emoteClue;
            }
            return FairyRingClue.forText(text);
        }
    }
    Item[] result = queryRunner.runQuery(new InventoryItemQuery(InventoryID.INVENTORY));
    if (result == null) {
        return null;
    }
    for (Item item : result) {
        MapClue clue = MapClue.forItemId(item.getId());
        if (clue != null) {
            return clue;
        }
    }
    return null;
}
Also used : Item(net.runelite.api.Item) MapClue(net.runelite.client.plugins.cluescrolls.clues.MapClue) EmoteClue(net.runelite.client.plugins.cluescrolls.clues.EmoteClue) Widget(net.runelite.api.widgets.Widget) InventoryItemQuery(net.runelite.api.queries.InventoryItemQuery) TextClueScroll(net.runelite.client.plugins.cluescrolls.clues.TextClueScroll) CrypticClue(net.runelite.client.plugins.cluescrolls.clues.CrypticClue)

Aggregations

EmoteClue (net.runelite.client.plugins.cluescrolls.clues.EmoteClue)3 Item (net.runelite.api.Item)2 InventoryItemQuery (net.runelite.api.queries.InventoryItemQuery)2 Widget (net.runelite.api.widgets.Widget)2 ClueScroll (net.runelite.client.plugins.cluescrolls.clues.ClueScroll)2 TextClueScroll (net.runelite.client.plugins.cluescrolls.clues.TextClueScroll)2 Query (net.runelite.api.Query)1 WorldPoint (net.runelite.api.coords.WorldPoint)1 GameObjectQuery (net.runelite.api.queries.GameObjectQuery)1 NPCQuery (net.runelite.api.queries.NPCQuery)1 CrypticClue (net.runelite.client.plugins.cluescrolls.clues.CrypticClue)1 MapClue (net.runelite.client.plugins.cluescrolls.clues.MapClue)1 NpcClueScroll (net.runelite.client.plugins.cluescrolls.clues.NpcClueScroll)1 ObjectClueScroll (net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll)1 Schedule (net.runelite.client.task.Schedule)1