use of net.runelite.client.ui.overlay.components.PanelComponent in project runelite by runelite.
the class CrypticClue method makeOverlayHint.
@Override
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) {
panelComponent.setTitle("Cryptic Clue");
panelComponent.setWidth(150);
panelComponent.getLines().add(new PanelComponent.Line("Clue:"));
panelComponent.getLines().add(new PanelComponent.Line(true, getText(), TITLED_CONTENT_COLOR));
if (getNpc() != null) {
panelComponent.getLines().add(new PanelComponent.Line("NPC:"));
panelComponent.getLines().add(new PanelComponent.Line(getNpc(), TITLED_CONTENT_COLOR));
}
if (objectId != -1) {
ObjectComposition object = plugin.getClient().getObjectDefinition(getObjectId());
if (object != null) {
panelComponent.getLines().add(new PanelComponent.Line("Object:"));
panelComponent.getLines().add(new PanelComponent.Line(object.getName(), TITLED_CONTENT_COLOR));
}
}
panelComponent.getLines().add(new PanelComponent.Line("Solution:"));
panelComponent.getLines().add(new PanelComponent.Line(true, getSolution(), TITLED_CONTENT_COLOR));
}
use of net.runelite.client.ui.overlay.components.PanelComponent in project runelite by runelite.
the class BoostsOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
panelComponent = new PanelComponent();
boolean overlayActive = false;
for (Skill skill : plugin.getShownSkills()) {
int boosted = client.getBoostedSkillLevel(skill), base = client.getRealSkillLevel(skill);
BoostIndicator indicator = indicators[skill.ordinal()];
if (boosted == base) {
if (indicator != null && infoBoxManager.getInfoBoxes().contains(indicator)) {
infoBoxManager.removeInfoBox(indicator);
}
continue;
}
overlayActive = true;
if (config.displayIndicators()) {
if (indicator == null) {
indicator = new BoostIndicator(skill, iconManager.getSkillImage(skill), plugin, client, config);
indicators[skill.ordinal()] = indicator;
}
if (!infoBoxManager.getInfoBoxes().contains(indicator)) {
infoBoxManager.addInfoBox(indicator);
}
} else {
if (indicator != null && infoBoxManager.getInfoBoxes().contains(indicator)) {
infoBoxManager.removeInfoBox(indicator);
}
String str;
int boost = boosted - base;
Color strColor = getTextColor(boost);
if (!config.useRelativeBoost()) {
str = "<col=" + Integer.toHexString(strColor.getRGB() & 0xFFFFFF) + ">" + boosted + "<col=ffffff>/" + base;
} else {
str = String.valueOf(boost);
if (boost > 0) {
str = "+" + str;
}
}
panelComponent.getLines().add(new PanelComponent.Line(skill.getName(), Color.WHITE, str, strColor));
}
}
Instant lastChange = plugin.getLastChange();
if (config.displayNextChange() && lastChange != null && overlayActive) {
int nextChange = 60 - (int) Duration.between(lastChange, Instant.now()).getSeconds();
if (nextChange > 0) {
panelComponent.getLines().add(new PanelComponent.Line("Next change in", Color.WHITE, String.valueOf(nextChange), Color.WHITE));
}
}
return panelComponent.getLines().isEmpty() ? null : panelComponent.render(graphics);
}
use of net.runelite.client.ui.overlay.components.PanelComponent in project runelite by runelite.
the class XpGlobesOverlay method drawTooltipIfMouseover.
private void drawTooltipIfMouseover(Graphics2D graphics, XpGlobe mouseOverSkill, Ellipse2D drawnGlobe) {
Point mouse = client.getMouseCanvasPosition();
int mouseX = mouse.getX();
int mouseY = mouse.getY();
if (!drawnGlobe.contains(mouseX, mouseY)) {
return;
}
// draw tooltip under the globe of the mouse location
int x = (int) drawnGlobe.getX() - (TOOLTIP_RECT_SIZE_X / 2) + (config.xpOrbSize() / 2);
int y = (int) drawnGlobe.getY() + config.xpOrbSize() + 10;
String skillName = mouseOverSkill.getSkillName();
String skillLevel = Integer.toString(mouseOverSkill.getCurrentLevel());
DecimalFormat decimalFormat = new DecimalFormat("###,###,###");
String skillCurrentXp = decimalFormat.format(mouseOverSkill.getCurrentXp());
PanelComponent xpTooltip = new PanelComponent();
xpTooltip.setPosition(new java.awt.Point(x, y));
xpTooltip.setWidth(TOOLTIP_RECT_SIZE_X);
List<PanelComponent.Line> lines = xpTooltip.getLines();
lines.add(new PanelComponent.Line(skillName, Color.WHITE, skillLevel, Color.WHITE));
lines.add(new PanelComponent.Line("Current xp:", Color.ORANGE, skillCurrentXp, Color.WHITE));
if (mouseOverSkill.getGoalXp() != -1) {
String skillXpToLvl = decimalFormat.format(mouseOverSkill.getGoalXp() - mouseOverSkill.getCurrentXp());
lines.add(new PanelComponent.Line("Xp to level:", Color.ORANGE, skillXpToLvl, Color.WHITE));
// Create progress bar for skill.
ProgressBarComponent progressBar = new ProgressBarComponent();
double progress = mouseOverSkill.getSkillProgress(Experience.getXpForLevel(mouseOverSkill.getCurrentLevel()), mouseOverSkill.getCurrentXp(), mouseOverSkill.getGoalXp());
progressBar.setProgress(progress);
xpTooltip.setProgressBar(progressBar);
}
xpTooltip.render(graphics);
}
use of net.runelite.client.ui.overlay.components.PanelComponent in project runelite by runelite.
the class MapClue method makeOverlayHint.
@Override
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) {
panelComponent.setTitle("Map Clue");
if (objectId != -1) {
panelComponent.setWidth(150);
ObjectComposition objectToClick = plugin.getClient().getObjectDefinition(getObjectId());
String objectName = "N/A";
if (objectToClick != null) {
objectName = objectToClick.getName();
}
panelComponent.getLines().add(new PanelComponent.Line("Travel to the destination"));
panelComponent.getLines().add(new PanelComponent.Line("and click the " + objectName + "."));
} else {
panelComponent.setWidth(160);
panelComponent.getLines().add(new PanelComponent.Line("Travel to the destination"));
panelComponent.getLines().add(new PanelComponent.Line("and dig on the marked tile."));
}
}
use of net.runelite.client.ui.overlay.components.PanelComponent in project runelite by runelite.
the class EmoteClue method makeOverlayHint.
@Override
public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) {
panelComponent.setTitle("Emote Clue");
panelComponent.getLines().add(new PanelComponent.Line("Emotes:"));
panelComponent.getLines().add(new PanelComponent.Line(getFirstEmote().getName(), TITLED_CONTENT_COLOR));
if (getSecondEmote() != null) {
panelComponent.getLines().add(new PanelComponent.Line(getSecondEmote().getName(), TITLED_CONTENT_COLOR));
}
if (getItemIds().length != 0) {
panelComponent.setWidth(160);
panelComponent.getLines().add(new PanelComponent.Line("Equip:"));
if (plugin.getEquippedItems() != null) {
for (int itemId : getItemIds()) {
ItemComposition itemDefinition = plugin.getClient().getItemDefinition(itemId);
if (itemDefinition != null) {
if (plugin.getEquippedItems().contains(itemId)) {
panelComponent.getLines().add(new PanelComponent.Line(itemDefinition.getName(), TITLED_CONTENT_COLOR, "X", Color.GREEN));
} else {
panelComponent.getLines().add(new PanelComponent.Line(itemDefinition.getName(), TITLED_CONTENT_COLOR, "-", Color.RED));
}
}
}
}
} else {
panelComponent.setWidth(130);
panelComponent.getLines().add(new PanelComponent.Line("Items:", "None"));
}
}
Aggregations