Search in sources :

Example 1 with TextClueScroll

use of net.runelite.client.plugins.cluescrolls.clues.TextClueScroll 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

Item (net.runelite.api.Item)1 InventoryItemQuery (net.runelite.api.queries.InventoryItemQuery)1 Widget (net.runelite.api.widgets.Widget)1 CrypticClue (net.runelite.client.plugins.cluescrolls.clues.CrypticClue)1 EmoteClue (net.runelite.client.plugins.cluescrolls.clues.EmoteClue)1 MapClue (net.runelite.client.plugins.cluescrolls.clues.MapClue)1 TextClueScroll (net.runelite.client.plugins.cluescrolls.clues.TextClueScroll)1