Merge branch 'mining-plugin-remove-pie-on-early-mlm-respawn' of https://github.com/Twiglet1022/runelite into newupdates
This commit is contained in:
@@ -31,6 +31,8 @@ import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
@@ -43,6 +45,13 @@ 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
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private 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 +76,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 +95,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);
|
||||
|
||||
@@ -39,7 +39,12 @@ import static net.runelite.api.ObjectID.DEPLETED_VEIN_26666;
|
||||
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26667;
|
||||
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26668;
|
||||
import static net.runelite.api.ObjectID.EMPTY_WALL;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26661;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26662;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26663;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26664;
|
||||
import net.runelite.api.WallObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.GameObjectDespawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -158,6 +163,15 @@ public class MiningPlugin extends Plugin
|
||||
respawns.add(rockRespawn);
|
||||
break;
|
||||
}
|
||||
case ORE_VEIN_26661: // Motherlode vein
|
||||
case ORE_VEIN_26662: // Motherlode vein
|
||||
case ORE_VEIN_26663: // Motherlode vein
|
||||
case ORE_VEIN_26664: // Motherlode vein
|
||||
{
|
||||
final WorldPoint point = object.getWorldLocation();
|
||||
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ enum Rock
|
||||
return inMiningGuild ? Duration.ofMinutes(6) : super.respawnTime;
|
||||
}
|
||||
},
|
||||
ORE_VEIN(Duration.ofSeconds(108), 150),
|
||||
ORE_VEIN(Duration.ofSeconds(MiningOverlay.getORE_VEIN_MAX_RESPAWN_TIME()), 150),
|
||||
AMETHYST(Duration.ofSeconds(75), 120);
|
||||
|
||||
private static final Map<Integer, Rock> ROCKS;
|
||||
|
||||
Reference in New Issue
Block a user