barrows overlay: Replace existing slain brother overlay with our own
The in game overlay is positioned top-left in resizable mode, which covers up everything positioned there. This will create an overlay similiar to the in-game one that can be moved/positioned anywhere
This commit is contained in:
@@ -83,6 +83,7 @@ public class WidgetID
|
||||
public static final int EXPERIENCE_TRACKER_GROUP_ID = 122;
|
||||
public static final int TITHE_FARM_GROUP_ID = 241;
|
||||
public static final int KINGDOM_GROUP_ID = 392;
|
||||
public static final int BARROWS_GROUP_ID = 24;
|
||||
|
||||
static class WorldMap
|
||||
{
|
||||
@@ -414,4 +415,10 @@ public class WidgetID
|
||||
{
|
||||
static final int FAIRY_QUEEN_HIDEOUT = 139;
|
||||
}
|
||||
|
||||
static class Barrows
|
||||
{
|
||||
static final int BARROWS_BROTHERS = 8;
|
||||
static final int BARROWS_POTENTIAL = 9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,11 @@ public enum WidgetInfo
|
||||
EXPERIENCE_TRACKER(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.WIDGET),
|
||||
EXPERIENCE_TRACKER_BOTTOM_BAR(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.BOTTOM_BAR),
|
||||
|
||||
TITHE_FARM(WidgetID.TITHE_FARM_GROUP_ID, 1);
|
||||
TITHE_FARM(WidgetID.TITHE_FARM_GROUP_ID, 1),
|
||||
|
||||
BARROWS_INFO(WidgetID.BARROWS_GROUP_ID, 0),
|
||||
BARROWS_BROTHERS(WidgetID.BARROWS_GROUP_ID, WidgetID.Barrows.BARROWS_BROTHERS),
|
||||
BARROWS_POTENTIAL(WidgetID.BARROWS_GROUP_ID, WidgetID.Barrows.BARROWS_POTENTIAL);
|
||||
|
||||
private final int groupId;
|
||||
private final int childId;
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Seth <http://github.com/sethtroll>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins.barrows;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
public class BarrowsBrotherSlainOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BarrowsBrotherSlainOverlay(Client client)
|
||||
{
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
// Do not display overlay if potential is null/hidden
|
||||
Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL);
|
||||
if (potential == null || potential.isHidden())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Hide original overlay
|
||||
Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS);
|
||||
if (barrowsBrothers != null)
|
||||
{
|
||||
barrowsBrothers.setHidden(true);
|
||||
}
|
||||
|
||||
panelComponent.getLines().clear();
|
||||
|
||||
for (BarrowsBrothers brother : BarrowsBrothers.values())
|
||||
{
|
||||
String slain = client.getSetting(brother.getKilledVarbit()) > 0 ? "✓" : "";
|
||||
panelComponent.getLines().add(new PanelComponent.Line(
|
||||
brother.getName(),
|
||||
Color.WHITE,
|
||||
slain,
|
||||
slain.isEmpty() ? Color.WHITE : Color.GREEN
|
||||
));
|
||||
}
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ package net.runelite.client.plugins.barrows;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
@@ -70,7 +72,10 @@ public class BarrowsPlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Set<GameObject> ladders = new HashSet<>();
|
||||
@Inject
|
||||
BarrowsOverlay barrowsOverlay;
|
||||
private BarrowsOverlay barrowsOverlay;
|
||||
|
||||
@Inject
|
||||
private BarrowsBrotherSlainOverlay brotherOverlay;
|
||||
|
||||
@Provides
|
||||
BarrowsConfig provideConfig(ConfigManager configManager)
|
||||
@@ -79,9 +84,9 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
public Overlay getOverlay()
|
||||
public Collection<Overlay> getOverlays()
|
||||
{
|
||||
return barrowsOverlay;
|
||||
return Arrays.asList(barrowsOverlay, brotherOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user