Add floor duration(s) to infobox tooltip
This commit is contained in:
@@ -78,6 +78,7 @@ public class RaidsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
private static final int LOBBY_PLANE = 3;
|
private static final int LOBBY_PLANE = 3;
|
||||||
private static final String RAID_START_MESSAGE = "The raid has begun!";
|
private static final String RAID_START_MESSAGE = "The raid has begun!";
|
||||||
|
private static final String LEVEL_COMPLETE_MESSAGE = "level complete!";
|
||||||
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("###.##");
|
||||||
@@ -258,10 +259,16 @@ public class RaidsPlugin extends Plugin
|
|||||||
infoBoxManager.addInfoBox(timer);
|
infoBoxManager.addInfoBox(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timer != null && message.contains(LEVEL_COMPLETE_MESSAGE))
|
||||||
|
{
|
||||||
|
timer.timeFloor();
|
||||||
|
}
|
||||||
|
|
||||||
if (message.startsWith(RAID_COMPLETE_MESSAGE))
|
if (message.startsWith(RAID_COMPLETE_MESSAGE))
|
||||||
{
|
{
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
|
timer.timeFloor();
|
||||||
timer.setStopped(true);
|
timer.setStopped(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ import net.runelite.client.ui.overlay.infobox.InfoBox;
|
|||||||
public class RaidsTimer extends InfoBox
|
public class RaidsTimer extends InfoBox
|
||||||
{
|
{
|
||||||
private final Instant startTime;
|
private final Instant startTime;
|
||||||
|
private Instant floorTime;
|
||||||
private LocalTime time;
|
private LocalTime time;
|
||||||
|
private LocalTime firstFloorTime;
|
||||||
|
private LocalTime secondFloorTime;
|
||||||
|
private LocalTime olmTime;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private boolean stopped;
|
private boolean stopped;
|
||||||
@@ -45,9 +49,30 @@ public class RaidsTimer extends InfoBox
|
|||||||
{
|
{
|
||||||
super(image);
|
super(image);
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
|
floorTime = startTime;
|
||||||
stopped = false;
|
stopped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void timeFloor()
|
||||||
|
{
|
||||||
|
Duration elapsed = Duration.between(floorTime, Instant.now());
|
||||||
|
|
||||||
|
if (firstFloorTime == null)
|
||||||
|
{
|
||||||
|
firstFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||||
|
}
|
||||||
|
else if (secondFloorTime == null)
|
||||||
|
{
|
||||||
|
secondFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||||
|
}
|
||||||
|
else if (olmTime == null)
|
||||||
|
{
|
||||||
|
olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
floorTime = Instant.now();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText()
|
public String getText()
|
||||||
{
|
{
|
||||||
@@ -84,6 +109,28 @@ public class RaidsTimer extends InfoBox
|
|||||||
@Override
|
@Override
|
||||||
public String getTooltip()
|
public String getTooltip()
|
||||||
{
|
{
|
||||||
return "Elapsed raid time: " + time.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Elapsed raid time: ");
|
||||||
|
builder.append(time.format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||||
|
|
||||||
|
if (firstFloorTime != null)
|
||||||
|
{
|
||||||
|
builder.append("</br>First floor: ");
|
||||||
|
builder.append(firstFloorTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (secondFloorTime != null)
|
||||||
|
{
|
||||||
|
builder.append("</br>Second floor: ");
|
||||||
|
builder.append(secondFloorTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (olmTime != null)
|
||||||
|
{
|
||||||
|
builder.append("</br>Olm: ");
|
||||||
|
builder.append(olmTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user