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
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "raidsTimer",
|
||||
name = "Display elapsed raid time",
|
||||
description = "Display elapsed raid time"
|
||||
@@ -46,6 +47,7 @@ public interface RaidsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "pointsMessage",
|
||||
name = "Display points in chatbox after 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(
|
||||
position = 2,
|
||||
keyName = "scoutOverlay",
|
||||
name = "Show scout overlay",
|
||||
description = "Display an overlay that shows the current raid layout (when entering lobby)"
|
||||
@@ -66,6 +69,7 @@ public interface RaidsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "scoutOverlayAtBank",
|
||||
name = "Show scout overlay outside lobby",
|
||||
description = "Keep the overlay active while at the raids area"
|
||||
@@ -76,6 +80,7 @@ public interface RaidsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "blacklistedRooms",
|
||||
name = "Blacklisted rooms",
|
||||
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)"
|
||||
@@ -84,4 +89,26 @@ public interface RaidsConfig extends Config
|
||||
{
|
||||
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.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())
|
||||
{
|
||||
int position = layoutRoom.getPosition();
|
||||
@@ -84,7 +96,7 @@ public class RaidsOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
Color color = Color.WHITE;
|
||||
color = Color.WHITE;
|
||||
|
||||
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 int TOTAL_POINTS = 0, PERSONAL_POINTS = 1, TEXT_CHILD = 4;
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
||||
private static final String SPLIT_REGEX = "\\s*,\\s*";
|
||||
|
||||
private BufferedImage raidsIcon;
|
||||
private RaidsTimer timer;
|
||||
@@ -100,6 +101,9 @@ public class RaidsPlugin extends Plugin
|
||||
@Getter
|
||||
private ArrayList<String> blacklist = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private ArrayList<String> layoutWhitelist = new ArrayList<>();
|
||||
|
||||
@Provides
|
||||
RaidsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -132,7 +136,7 @@ public class RaidsPlugin extends Plugin
|
||||
cacheColors();
|
||||
}
|
||||
|
||||
updateBlacklist();
|
||||
updateLists();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +163,12 @@ public class RaidsPlugin extends Plugin
|
||||
|
||||
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();
|
||||
blacklist.addAll(Arrays.asList(config.blacklistedRooms().toLowerCase().split("\\s*,\\s*")));
|
||||
updateList(blacklist, config.blacklistedRooms());
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user