mining: add Lovakite rocks

This commit is contained in:
Alexsuperfly
2019-12-11 14:49:03 -05:00
committed by Adam
parent 7b453cf263
commit 7b1819a207
3 changed files with 28 additions and 2 deletions

View File

@@ -45,6 +45,11 @@ class MiningOverlay extends Overlay
static final int ORE_VEIN_MAX_RESPAWN_TIME = 277; // Game ticks
private static final int ORE_VEIN_MIN_RESPAWN_TIME = 150; // Game ticks
private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME;
static final int LOVAKITE_ORE_MAX_RESPAWN_TIME = 65; // Game ticks
private static final int LOVAKITE_ORE_MIN_RESPAWN_TIME = 50; // Game ticks
private static final float LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD = (float) LOVAKITE_ORE_MIN_RESPAWN_TIME / LOVAKITE_ORE_MAX_RESPAWN_TIME;
private static final Color DARK_GREEN = new Color(0, 100, 0);
private static final int MOTHERLODE_UPPER_FLOOR_HEIGHT = -500;
@@ -97,8 +102,9 @@ class MiningOverlay extends Overlay
Color pieFillColor = Color.YELLOW;
Color pieBorderColor = Color.ORANGE;
// Recolour pie on motherlode veins during the portion of the timer where they may respawn
if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
// Recolour pie on motherlode veins or Lovakite ore during the portion of the timer where they may respawn
if ((rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|| (rock == Rock.LOVAKITE && percent > LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD))
{
pieFillColor = Color.GREEN;
pieBorderColor = DARK_GREEN;

View File

@@ -45,6 +45,7 @@ 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.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.WallObjectSpawned;
@@ -132,6 +133,24 @@ public class MiningPlugin extends Plugin
}
}
@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event)
{
if (client.getGameState() != GameState.LOGGED_IN)
{
return;
}
GameObject object = event.getGameObject();
// If the Lovakite ore respawns before the timer is up, remove it
if (Rock.getRock(object.getId()) == Rock.LOVAKITE)
{
final WorldPoint point = object.getWorldLocation();
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
}
}
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{

View File

@@ -72,6 +72,7 @@ enum Rock
return region == MINING_GUILD ? Duration.of(100, GAME_TICKS) : super.respawnTime;
}
},
LOVAKITE(Duration.of(MiningOverlay.LOVAKITE_ORE_MAX_RESPAWN_TIME, GAME_TICKS), 0, ROCKS_28596, ROCKS_28597),
ADAMANTITE(Duration.of(400, GAME_TICKS), 0, ROCKS_11374, ROCKS_11375, ROCKS_36208)
{
@Override