Merge pull request #13217 from NJohnsonJ/feature/daeyalt-rock-minimap-indicator
This commit is contained in:
@@ -39,6 +39,7 @@ import net.runelite.api.ChatMessageType;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import static net.runelite.api.HintArrowType.WORLD_POSITION;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26665;
|
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26665;
|
||||||
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26666;
|
import static net.runelite.api.ObjectID.DEPLETED_VEIN_26666;
|
||||||
@@ -133,6 +134,7 @@ public class MiningPlugin extends Plugin
|
|||||||
pickaxe = null;
|
pickaxe = null;
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
overlayManager.remove(rocksOverlay);
|
overlayManager.remove(rocksOverlay);
|
||||||
|
respawns.forEach(respawn -> clearHintArrowAt(respawn.getWorldPoint()));
|
||||||
respawns.clear();
|
respawns.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +202,7 @@ public class MiningPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick gameTick)
|
public void onGameTick(GameTick gameTick)
|
||||||
{
|
{
|
||||||
respawns.removeIf(RockRespawn::isExpired);
|
clearExpiredRespawns();
|
||||||
recentlyLoggedIn = false;
|
recentlyLoggedIn = false;
|
||||||
|
|
||||||
if (session == null || session.getLastMined() == null)
|
if (session == null || session.getLastMined() == null)
|
||||||
@@ -223,6 +225,24 @@ public class MiningPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears expired respawns and removes the hint arrow from expired Daeyalt essence rocks.
|
||||||
|
*/
|
||||||
|
private void clearExpiredRespawns()
|
||||||
|
{
|
||||||
|
respawns.removeIf(rockRespawn ->
|
||||||
|
{
|
||||||
|
final boolean expired = rockRespawn.isExpired();
|
||||||
|
|
||||||
|
if (expired && rockRespawn.getRock() == Rock.DAEYALT_ESSENCE)
|
||||||
|
{
|
||||||
|
clearHintArrowAt(rockRespawn.getWorldPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
return expired;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void resetSession()
|
public void resetSession()
|
||||||
{
|
{
|
||||||
session = null;
|
session = null;
|
||||||
@@ -243,19 +263,29 @@ public class MiningPlugin extends Plugin
|
|||||||
Rock rock = Rock.getRock(object.getId());
|
Rock rock = Rock.getRock(object.getId());
|
||||||
if (rock != null)
|
if (rock != null)
|
||||||
{
|
{
|
||||||
|
final WorldPoint point = object.getWorldLocation();
|
||||||
|
|
||||||
if (rock == Rock.DAEYALT_ESSENCE)
|
if (rock == Rock.DAEYALT_ESSENCE)
|
||||||
{
|
{
|
||||||
final WorldPoint point = object.getWorldLocation();
|
|
||||||
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
|
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
|
||||||
|
clearHintArrowAt(point);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
RockRespawn rockRespawn = new RockRespawn(rock, point, Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
||||||
respawns.add(rockRespawn);
|
respawns.add(rockRespawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearHintArrowAt(WorldPoint worldPoint)
|
||||||
|
{
|
||||||
|
if (client.getHintArrowType() == WORLD_POSITION && client.getHintArrowPoint().equals(worldPoint))
|
||||||
|
{
|
||||||
|
client.clearHintArrow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameObjectSpawned(GameObjectSpawned event)
|
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||||
{
|
{
|
||||||
@@ -273,6 +303,7 @@ public class MiningPlugin extends Plugin
|
|||||||
final int region = client.getLocalPlayer().getWorldLocation().getRegionID();
|
final int region = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||||
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
||||||
respawns.add(rockRespawn);
|
respawns.add(rockRespawn);
|
||||||
|
client.setHintArrow(object.getWorldLocation());
|
||||||
}
|
}
|
||||||
// If the Lovakite ore respawns before the timer is up, remove it
|
// If the Lovakite ore respawns before the timer is up, remove it
|
||||||
else if (rock == Rock.LOVAKITE)
|
else if (rock == Rock.LOVAKITE)
|
||||||
|
|||||||
Reference in New Issue
Block a user