From 7b1819a207e8010ac3f8d4e9d0822d5f9c728cba Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Wed, 11 Dec 2019 14:49:03 -0500 Subject: [PATCH] mining: add Lovakite rocks --- .../client/plugins/mining/MiningOverlay.java | 10 ++++++++-- .../client/plugins/mining/MiningPlugin.java | 19 +++++++++++++++++++ .../runelite/client/plugins/mining/Rock.java | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java index 9da2bbcca7..df000638ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java @@ -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; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java index c968a4b9cb..be0bdcee70 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java @@ -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) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java index dabe0ececc..8dc2bdac7b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java @@ -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