raids: Fix !layout command & update RaidOverlay (#2200)
This commit is contained in:
@@ -147,6 +147,29 @@ class Raid
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the raid rooms in the order they are in the raid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RaidRoom> getOrderedRooms()
|
||||||
|
{
|
||||||
|
List<RaidRoom> orderedRooms = new ArrayList<>();
|
||||||
|
for (Room r : getLayout().getRooms())
|
||||||
|
{
|
||||||
|
final int position = r.getPosition();
|
||||||
|
final RaidRoom room = getRoom(position);
|
||||||
|
|
||||||
|
if (room == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
orderedRooms.add(room);
|
||||||
|
}
|
||||||
|
|
||||||
|
return orderedRooms;
|
||||||
|
}
|
||||||
|
|
||||||
String toRoomString()
|
String toRoomString()
|
||||||
{
|
{
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ package net.runelite.client.plugins.raids;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -163,6 +162,7 @@ public class RaidsOverlay extends Overlay
|
|||||||
boolean thieving = false;
|
boolean thieving = false;
|
||||||
boolean vanguards = false;
|
boolean vanguards = false;
|
||||||
boolean unknownCombat = false;
|
boolean unknownCombat = false;
|
||||||
|
boolean unknownPuzzle = false;
|
||||||
String puzzles = "";
|
String puzzles = "";
|
||||||
String roomName;
|
String roomName;
|
||||||
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
||||||
@@ -205,6 +205,9 @@ public class RaidsOverlay extends Overlay
|
|||||||
case TIGHTROPE:
|
case TIGHTROPE:
|
||||||
tightrope = true;
|
tightrope = true;
|
||||||
break;
|
break;
|
||||||
|
case UNKNOWN_PUZZLE:
|
||||||
|
unknownPuzzle = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SCAVENGERS:
|
case SCAVENGERS:
|
||||||
@@ -273,7 +276,6 @@ public class RaidsOverlay extends Overlay
|
|||||||
|
|
||||||
TableComponent tableComponent = new TableComponent();
|
TableComponent tableComponent = new TableComponent();
|
||||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||||
|
|
||||||
color = Color.ORANGE;
|
color = Color.ORANGE;
|
||||||
if (sharable || plugin.isAlwaysShowWorldAndCC())
|
if (sharable || plugin.isAlwaysShowWorldAndCC())
|
||||||
{
|
{
|
||||||
@@ -330,7 +332,11 @@ public class RaidsOverlay extends Overlay
|
|||||||
imageIds.addAll(plugin.getRecommendedItemsList().get(bossNameLC));
|
imageIds.addAll(plugin.getRecommendedItemsList().get(bossNameLC));
|
||||||
}
|
}
|
||||||
|
|
||||||
tableComponent.addRow(plugin.isShowRecommendedItems() ? "" : room.getType().getName(), ColorUtil.prependColorTag(bossName, color));
|
if (bossNameLC.startsWith("unknown"))
|
||||||
|
{
|
||||||
|
bossName = "Unknown";
|
||||||
|
}
|
||||||
|
tableComponent.addRow(room.getType().getName(), ColorUtil.prependColorTag(bossName, color));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -373,7 +379,12 @@ public class RaidsOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tableComponent.addRow(plugin.isShowRecommendedItems() ? "" : room.getType().getName(), ColorUtil.prependColorTag(puzzleName, color));
|
if (puzzleNameLC.startsWith("unknown"))
|
||||||
|
{
|
||||||
|
puzzleName = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
tableComponent.addRow(room.getType().getName(), ColorUtil.prependColorTag(puzzleName, color));
|
||||||
break;
|
break;
|
||||||
case FARMING:
|
case FARMING:
|
||||||
if (plugin.isShowScavsFarms())
|
if (plugin.isShowScavsFarms())
|
||||||
@@ -384,11 +395,11 @@ public class RaidsOverlay extends Overlay
|
|||||||
case SCAVENGERS:
|
case SCAVENGERS:
|
||||||
if (plugin.isScavsBeforeOlm() && roomCount == lastScavs)
|
if (plugin.isScavsBeforeOlm() && roomCount == lastScavs)
|
||||||
{
|
{
|
||||||
tableComponent.addRow(plugin.isShowRecommendedItems() ? "" : "OlmPrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor()));
|
tableComponent.addRow("OlmPrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor()));
|
||||||
}
|
}
|
||||||
else if (plugin.isScavsBeforeIce() && scavsBeforeIceRooms.contains(roomCount))
|
else if (plugin.isScavsBeforeIce() && scavsBeforeIceRooms.contains(roomCount))
|
||||||
{
|
{
|
||||||
tableComponent.addRow(plugin.isShowRecommendedItems() ? "" : "IcePrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor()));
|
tableComponent.addRow("IcePrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor()));
|
||||||
}
|
}
|
||||||
else if (plugin.isShowScavsFarms())
|
else if (plugin.isShowScavsFarms())
|
||||||
{
|
{
|
||||||
@@ -401,32 +412,21 @@ public class RaidsOverlay extends Overlay
|
|||||||
|
|
||||||
panelComponent.getChildren().add(tableComponent);
|
panelComponent.getChildren().add(tableComponent);
|
||||||
|
|
||||||
Dimension panelDims = panelComponent.render(graphics);
|
|
||||||
width = (int) panelDims.getWidth();
|
|
||||||
height = (int) panelDims.getHeight();
|
|
||||||
|
|
||||||
//add recommended items
|
//add recommended items
|
||||||
if (plugin.isShowRecommendedItems() && imageIds.size() > 0)
|
if (plugin.isShowRecommendedItems() && imageIds.size() > 0)
|
||||||
{
|
{
|
||||||
panelImages.getChildren().clear();
|
panelImages.getChildren().clear();
|
||||||
|
|
||||||
Integer[] idArray = imageIds.toArray(new Integer[0]);
|
Integer[] idArray = imageIds.toArray(new Integer[0]);
|
||||||
int imagesVerticalOffset = TITLE_COMPONENT_HEIGHT + (sharable || plugin.isAlwaysShowWorldAndCC() ? LINE_COMPONENT_HEIGHT : 0) - BORDER_OFFSET;
|
|
||||||
int imagesMaxHeight = height - 2 * BORDER_OFFSET - TITLE_COMPONENT_HEIGHT - (sharable || plugin.isAlwaysShowWorldAndCC() ? LINE_COMPONENT_HEIGHT : 0);
|
|
||||||
boolean smallImages = false;
|
boolean smallImages = false;
|
||||||
|
|
||||||
panelImages.setPreferredLocation(new Point(0, imagesVerticalOffset));
|
|
||||||
panelImages.setBackgroundColor(null);
|
panelImages.setBackgroundColor(null);
|
||||||
if (2 * (imagesMaxHeight / ICON_SIZE) >= idArray.length)
|
|
||||||
{
|
|
||||||
panelImages.setWrapping(2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
panelImages.setWrapping(3);
|
|
||||||
smallImages = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
panelImages.setOrientation(ComponentOrientation.HORIZONTAL);
|
panelImages.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||||
|
panelImages.setWrapping(4);
|
||||||
|
|
||||||
|
|
||||||
for (Integer e : idArray)
|
for (Integer e : idArray)
|
||||||
{
|
{
|
||||||
final BufferedImage image = getImage(e, smallImages);
|
final BufferedImage image = getImage(e, smallImages);
|
||||||
@@ -435,9 +435,13 @@ public class RaidsOverlay extends Overlay
|
|||||||
panelImages.getChildren().add(new ImageComponent(image));
|
panelImages.getChildren().add(new ImageComponent(image));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
panelComponent.getChildren().add(panelImages);
|
||||||
panelImages.render(graphics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dimension panelDims = panelComponent.render(graphics);
|
||||||
|
width = (int) panelDims.getWidth();
|
||||||
|
height = (int) panelDims.getHeight();
|
||||||
return panelDims;
|
return panelDims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,9 +408,9 @@ public class RaidsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String playerName = client.getLocalPlayer().getName();
|
final String playerName = client.getLocalPlayer().getName();
|
||||||
RaidRoom[] rooms = raid.getRooms();
|
List<RaidRoom> orderedRooms = raid.getOrderedRooms();
|
||||||
|
|
||||||
LayoutRoom[] layoutRooms = Arrays.stream(rooms)
|
LayoutRoom[] layoutRooms = orderedRooms.stream()
|
||||||
.map(room -> LayoutRoom.valueOf(room.name()))
|
.map(room -> LayoutRoom.valueOf(room.name()))
|
||||||
.toArray(LayoutRoom[]::new);
|
.toArray(LayoutRoom[]::new);
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class ImageComponent implements LayoutableRenderableEntity
|
|||||||
final Dimension dimension = new Dimension(image.getWidth(), image.getHeight());
|
final Dimension dimension = new Dimension(image.getWidth(), image.getHeight());
|
||||||
bounds.setLocation(preferredLocation);
|
bounds.setLocation(preferredLocation);
|
||||||
bounds.setSize(dimension);
|
bounds.setSize(dimension);
|
||||||
|
setPreferredSize(dimension);
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user