mining plugin: recolour pie in MLM during random segment of timer
This commit is contained in:
@@ -43,6 +43,12 @@ import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
|
||||
class MiningOverlay extends Overlay
|
||||
{
|
||||
// Range of Motherlode vein respawn time - not 100% confirmed but based on observation
|
||||
static final int ORE_VEIN_MAX_RESPAWN_TIME = 123;
|
||||
private static final int ORE_VEIN_MIN_RESPAWN_TIME = 90;
|
||||
private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME;
|
||||
private static final Color DARK_GREEN = new Color(0, 100, 0);
|
||||
|
||||
private final Client client;
|
||||
private final MiningPlugin plugin;
|
||||
|
||||
@@ -67,6 +73,8 @@ class MiningOverlay extends Overlay
|
||||
Instant now = Instant.now();
|
||||
for (Iterator<RockRespawn> it = respawns.iterator(); it.hasNext();)
|
||||
{
|
||||
Color pieFillColor = Color.YELLOW;
|
||||
Color pieBorderColor = Color.ORANGE;
|
||||
RockRespawn rockRespawn = it.next();
|
||||
float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime();
|
||||
WorldPoint worldPoint = rockRespawn.getWorldPoint();
|
||||
@@ -84,9 +92,16 @@ class MiningOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
// Recolour pie on motherlode veins during the portion of the timer where they may respawn
|
||||
if (rockRespawn.getRock() == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|
||||
{
|
||||
pieFillColor = Color.GREEN;
|
||||
pieBorderColor = DARK_GREEN;
|
||||
}
|
||||
|
||||
ProgressPieComponent ppc = new ProgressPieComponent();
|
||||
ppc.setBorderColor(Color.ORANGE);
|
||||
ppc.setFill(Color.YELLOW);
|
||||
ppc.setBorderColor(pieBorderColor);
|
||||
ppc.setFill(pieFillColor);
|
||||
ppc.setPosition(point);
|
||||
ppc.setProgress(percent);
|
||||
ppc.render(graphics);
|
||||
|
||||
@@ -98,7 +98,7 @@ enum Rock
|
||||
return inMiningGuild ? Duration.ofMinutes(6) : super.respawnTime;
|
||||
}
|
||||
},
|
||||
ORE_VEIN(Duration.ofSeconds(108), 150),
|
||||
ORE_VEIN(Duration.ofSeconds(MiningOverlay.ORE_VEIN_MAX_RESPAWN_TIME), 150),
|
||||
AMETHYST(Duration.ofSeconds(75), 120);
|
||||
|
||||
private static final Map<Integer, Rock> ROCKS;
|
||||
|
||||
Reference in New Issue
Block a user