clues: highlight the last clue's STASH until items are deposited back

This commit is contained in:
Hydrox6
2021-04-26 13:49:36 +01:00
committed by Adam
parent 94685b6ef4
commit aa44339769
4 changed files with 93 additions and 3 deletions

View File

@@ -217,6 +217,10 @@ public class ClueScrollPlugin extends Plugin
private final TextComponent textComponent = new TextComponent();
@Getter
private EmoteClue activeSTASHClue;
private EmoteClue clickedSTASHClue;
@Provides
ClueScrollConfig getConfig(ConfigManager configManager)
{
@@ -264,9 +268,11 @@ public class ClueScrollPlugin extends Plugin
return;
}
String message = event.getMessage();
if (clue instanceof HotColdClue)
{
if (((HotColdClue) clue).update(event.getMessage(), this))
if (((HotColdClue) clue).update(message, this))
{
worldMapPointsSet = false;
}
@@ -274,7 +280,7 @@ public class ClueScrollPlugin extends Plugin
if (clue instanceof SkillChallengeClue)
{
String text = Text.removeTags(event.getMessage());
String text = Text.removeTags(message);
if (text.equals("Skill challenge completed.") ||
text.equals("You have completed your master level challenge!") ||
text.startsWith("You have completed Charlie's task,") ||
@@ -283,6 +289,19 @@ public class ClueScrollPlugin extends Plugin
((SkillChallengeClue) clue).setChallengeCompleted(true);
}
}
if (message.endsWith(" the STASH unit."))
{
if (clue instanceof EmoteClue && clickedSTASHClue != null && message.equals("You withdraw your items from the STASH unit."))
{
activeSTASHClue = clickedSTASHClue;
}
else if (message.equals("You deposit your items into the STASH unit."))
{
activeSTASHClue = null;
}
clickedSTASHClue = null;
}
}
@Subscribe
@@ -300,7 +319,11 @@ public class ClueScrollPlugin extends Plugin
@Subscribe
public void onMenuOptionClicked(final MenuOptionClicked event)
{
if (event.getMenuOption() != null && event.getMenuOption().equals("Read"))
if (event.getMenuOption() == null)
{
return;
}
if (event.getMenuOption().equals("Read"))
{
final ItemComposition itemComposition = itemManager.getItemComposition(event.getId());
@@ -310,6 +333,14 @@ public class ClueScrollPlugin extends Plugin
updateClue(MapClue.forItemId(clueItemId));
}
}
else if (event.getMenuOption().equals("Search") && clue instanceof EmoteClue)
{
EmoteClue emoteClue = (EmoteClue) clue;
if (emoteClue.getStashUnit() != null && emoteClue.getStashUnit().getObjectId() == event.getId())
{
clickedSTASHClue = emoteClue;
}
}
}
@Subscribe

View File

@@ -29,6 +29,7 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
import net.runelite.client.plugins.cluescrolls.clues.EmoteClue;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -61,6 +62,12 @@ public class ClueScrollWorldOverlay extends Overlay
clue.makeWorldOverlayHint(graphics, plugin);
}
EmoteClue activeSTASHClue = plugin.getActiveSTASHClue();
if (activeSTASHClue != null && activeSTASHClue != clue)
{
activeSTASHClue.makeSTASHOverlay(graphics, plugin);
}
return null;
}
}

View File

@@ -311,6 +311,11 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localPoint, plugin.getEmoteImage(), Color.ORANGE);
}
makeSTASHOverlay(graphics, plugin);
}
public void makeSTASHOverlay(Graphics2D graphics, ClueScrollPlugin plugin)
{
if (stashUnit != null)
{
final WorldPoint[] worldPoints = stashUnit.getWorldPoints();