Add ability to whitelist layouts
This commit is contained in:
@@ -36,6 +36,7 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface RaidsConfig extends Config
|
public interface RaidsConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 0,
|
||||||
keyName = "raidsTimer",
|
keyName = "raidsTimer",
|
||||||
name = "Display elapsed raid time",
|
name = "Display elapsed raid time",
|
||||||
description = "Display elapsed raid time"
|
description = "Display elapsed raid time"
|
||||||
@@ -46,6 +47,7 @@ public interface RaidsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 1,
|
||||||
keyName = "pointsMessage",
|
keyName = "pointsMessage",
|
||||||
name = "Display points in chatbox after raid",
|
name = "Display points in chatbox after raid",
|
||||||
description = "Display a message with total points, individual points and percentage at the end of a raid"
|
description = "Display a message with total points, individual points and percentage at the end of a raid"
|
||||||
@@ -56,6 +58,7 @@ public interface RaidsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 2,
|
||||||
keyName = "scoutOverlay",
|
keyName = "scoutOverlay",
|
||||||
name = "Show scout overlay",
|
name = "Show scout overlay",
|
||||||
description = "Display an overlay that shows the current raid layout (when entering lobby)"
|
description = "Display an overlay that shows the current raid layout (when entering lobby)"
|
||||||
@@ -66,6 +69,7 @@ public interface RaidsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 3,
|
||||||
keyName = "scoutOverlayAtBank",
|
keyName = "scoutOverlayAtBank",
|
||||||
name = "Show scout overlay outside lobby",
|
name = "Show scout overlay outside lobby",
|
||||||
description = "Keep the overlay active while at the raids area"
|
description = "Keep the overlay active while at the raids area"
|
||||||
@@ -76,6 +80,7 @@ public interface RaidsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
position = 4,
|
||||||
keyName = "blacklistedRooms",
|
keyName = "blacklistedRooms",
|
||||||
name = "Blacklisted rooms",
|
name = "Blacklisted rooms",
|
||||||
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)"
|
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)"
|
||||||
@@ -84,4 +89,26 @@ public interface RaidsConfig extends Config
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 5,
|
||||||
|
keyName = "enableLayoutWhitelist",
|
||||||
|
name = "Enable layout whitelist",
|
||||||
|
description = "Enable the layout whitelist"
|
||||||
|
)
|
||||||
|
default boolean enableLayoutWhitelist()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
|
keyName = "whitelistedLayouts",
|
||||||
|
name = "Whitelisted layouts",
|
||||||
|
description = "Warn when layout doesn't match a whitelisted one. Add layouts like CFSCPPCSCF separated with comma"
|
||||||
|
)
|
||||||
|
default String whitelistedLayouts()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,18 @@ public class RaidsOverlay extends Overlay
|
|||||||
panelComponent.setTitleColor(Color.WHITE);
|
panelComponent.setTitleColor(Color.WHITE);
|
||||||
panelComponent.setTitle("Raid scouter");
|
panelComponent.setTitle("Raid scouter");
|
||||||
|
|
||||||
|
Color color = Color.WHITE;
|
||||||
|
String layout = plugin.getRaid().getLayout().toCode().replaceAll("#", "").replaceAll("¤", "");
|
||||||
|
|
||||||
|
if (config.enableLayoutWhitelist() && !plugin.getLayoutWhitelist().contains(layout.toLowerCase()))
|
||||||
|
{
|
||||||
|
color = Color.RED;
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getLines().add(new PanelComponent.Line(
|
||||||
|
"Layout", Color.WHITE, layout, color
|
||||||
|
));
|
||||||
|
|
||||||
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
||||||
{
|
{
|
||||||
int position = layoutRoom.getPosition();
|
int position = layoutRoom.getPosition();
|
||||||
@@ -84,7 +96,7 @@ public class RaidsOverlay extends Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = Color.WHITE;
|
color = Color.WHITE;
|
||||||
|
|
||||||
switch (room.getType())
|
switch (room.getType())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class RaidsPlugin extends Plugin
|
|||||||
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
|
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
|
||||||
private static final int TOTAL_POINTS = 0, PERSONAL_POINTS = 1, TEXT_CHILD = 4;
|
private static final int TOTAL_POINTS = 0, PERSONAL_POINTS = 1, TEXT_CHILD = 4;
|
||||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
||||||
|
private static final String SPLIT_REGEX = "\\s*,\\s*";
|
||||||
|
|
||||||
private BufferedImage raidsIcon;
|
private BufferedImage raidsIcon;
|
||||||
private RaidsTimer timer;
|
private RaidsTimer timer;
|
||||||
@@ -100,6 +101,9 @@ public class RaidsPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private ArrayList<String> blacklist = new ArrayList<>();
|
private ArrayList<String> blacklist = new ArrayList<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private ArrayList<String> layoutWhitelist = new ArrayList<>();
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
RaidsConfig provideConfig(ConfigManager configManager)
|
RaidsConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -132,7 +136,7 @@ public class RaidsPlugin extends Plugin
|
|||||||
cacheColors();
|
cacheColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBlacklist();
|
updateLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -159,7 +163,12 @@ public class RaidsPlugin extends Plugin
|
|||||||
|
|
||||||
if (event.getKey().equals("blacklistedRooms"))
|
if (event.getKey().equals("blacklistedRooms"))
|
||||||
{
|
{
|
||||||
updateBlacklist();
|
updateList(blacklist, config.blacklistedRooms());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getKey().equals("whitelistedLayouts"))
|
||||||
|
{
|
||||||
|
updateList(layoutWhitelist, config.whitelistedLayouts());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,10 +293,16 @@ public class RaidsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBlacklist()
|
private void updateLists()
|
||||||
{
|
{
|
||||||
blacklist.clear();
|
updateList(blacklist, config.blacklistedRooms());
|
||||||
blacklist.addAll(Arrays.asList(config.blacklistedRooms().toLowerCase().split("\\s*,\\s*")));
|
updateList(layoutWhitelist, config.whitelistedLayouts());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateList(ArrayList<String> list, String input)
|
||||||
|
{
|
||||||
|
list.clear();
|
||||||
|
list.addAll(Arrays.asList(input.toLowerCase().split(SPLIT_REGEX)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cacheColors()
|
private void cacheColors()
|
||||||
|
|||||||
Reference in New Issue
Block a user