Merge pull request #853 from Kamielvf/raids-move-points-box

Raids plugin: Reposition the points box to prevent it from overlapping overlays
This commit is contained in:
Tomas Slusny
2018-03-09 00:06:51 +01:00
committed by GitHub
5 changed files with 48 additions and 1 deletions

View File

@@ -57,6 +57,11 @@ public class RaidsOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (plugin.isInRaidChambers())
{
plugin.repositionPointsBox();
}
if (!config.scoutOverlay() || !scoutOverlayShown)
{
return null;

View File

@@ -53,6 +53,8 @@ import static net.runelite.api.Perspective.SCENE_SIZE;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.chat.ChatColor;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
@@ -84,6 +86,8 @@ public class RaidsPlugin extends Plugin
private BufferedImage raidsIcon;
private RaidsTimer timer;
@Getter
private boolean inRaidChambers;
@Inject
@@ -302,6 +306,27 @@ public class RaidsPlugin extends Plugin
}
}
public void repositionPointsBox()
{
Widget widget = client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX);
int x = widget.getParent().getWidth() - widget.getWidth() - 2;
int y = widget.getOriginalY();
if (client.getSetting(Varbits.EXPERIENCE_TRACKER_POSITION) == 0)
{
Widget area = client.getWidget(WidgetInfo.EXPERIENCE_TRACKER_BOTTOM_BAR);
if (area != null)
{
y = area.getOriginalY() + 2;
area.setRelativeY(y + widget.getHeight());
}
}
widget.setRelativeX(x);
widget.setRelativeY(y);
}
private void updateInfoBoxState()
{
if (timer != null)