mining plugin: only show timers on same level in motherlode mine
This commit is contained in:
@@ -48,6 +48,7 @@ class MiningOverlay extends Overlay
|
||||
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 static final int MOTHERLODE_UPPER_FLOOR_HEIGHT = -500;
|
||||
|
||||
private final Client client;
|
||||
private final MiningPlugin plugin;
|
||||
@@ -92,8 +93,17 @@ class MiningOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
Rock rock = rockRespawn.getRock();
|
||||
|
||||
// Only draw timer for veins on the same level in motherlode mine
|
||||
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
|
||||
if (rock == Rock.ORE_VEIN && isUpstairsMotherlode(localLocation) != isUpstairsMotherlode(loc))
|
||||
{
|
||||
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)
|
||||
if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|
||||
{
|
||||
pieFillColor = Color.GREEN;
|
||||
pieBorderColor = DARK_GREEN;
|
||||
@@ -108,4 +118,19 @@ class MiningOverlay extends Overlay
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given point is "upstairs" in the mlm.
|
||||
* The upper floor is actually on z=0.
|
||||
*
|
||||
* This method assumes that the given point is already in the mlm
|
||||
* and is not meaningful when outside the mlm.
|
||||
*
|
||||
* @param localPoint the LocalPoint to be tested
|
||||
* @return true if localPoint is at same height as mlm upper floor
|
||||
*/
|
||||
private boolean isUpstairsMotherlode(LocalPoint localPoint)
|
||||
{
|
||||
return Perspective.getTileHeight(client, localPoint, 0) < MOTHERLODE_UPPER_FLOOR_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user