mining: Add Daeyalt essence timers
This commit is contained in:
@@ -46,6 +46,10 @@ class MiningOverlay extends Overlay
|
||||
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 DAEYALT_MAX_RESPAWN_TIME = 110; // Game ticks
|
||||
private static final int DAEYALT_MIN_RESPAWN_TIME = 91; // Game ticks
|
||||
private static final float DAEYALT_RANDOM_PERCENT_THRESHOLD = (float) DAEYALT_MIN_RESPAWN_TIME / DAEYALT_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;
|
||||
@@ -104,6 +108,7 @@ class MiningOverlay extends Overlay
|
||||
|
||||
// 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.DAEYALT_ESSENCE && percent > DAEYALT_RANDOM_PERCENT_THRESHOLD)
|
||||
|| (rock == Rock.LOVAKITE && percent > LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD))
|
||||
{
|
||||
pieFillColor = Color.GREEN;
|
||||
|
||||
@@ -128,23 +128,39 @@ public class MiningPlugin extends Plugin
|
||||
Rock rock = Rock.getRock(object.getId());
|
||||
if (rock != null)
|
||||
{
|
||||
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
||||
respawns.add(rockRespawn);
|
||||
if (rock == Rock.DAEYALT_ESSENCE)
|
||||
{
|
||||
final WorldPoint point = object.getWorldLocation();
|
||||
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
|
||||
}
|
||||
else
|
||||
{
|
||||
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
||||
respawns.add(rockRespawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
if (client.getGameState() != GameState.LOGGED_IN || recentlyLoggedIn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject object = event.getGameObject();
|
||||
Rock rock = Rock.getRock(object.getId());
|
||||
|
||||
// Inverse timer to track daeyalt essence active duration
|
||||
if (rock == Rock.DAEYALT_ESSENCE)
|
||||
{
|
||||
final int region = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||
RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset());
|
||||
respawns.add(rockRespawn);
|
||||
}
|
||||
// If the Lovakite ore respawns before the timer is up, remove it
|
||||
if (Rock.getRock(object.getId()) == Rock.LOVAKITE)
|
||||
else if (rock == Rock.LOVAKITE)
|
||||
{
|
||||
final WorldPoint point = object.getWorldLocation();
|
||||
respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point));
|
||||
|
||||
@@ -96,7 +96,8 @@ enum Rock
|
||||
URT_SALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33254),
|
||||
EFH_SALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33255),
|
||||
TE_SALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33256),
|
||||
BASALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33257);
|
||||
BASALT(Duration.of(9, GAME_TICKS), 0, ROCKS_33257),
|
||||
DAEYALT_ESSENCE(Duration.of(MiningOverlay.DAEYALT_MAX_RESPAWN_TIME, GAME_TICKS), 0, DAEYALT_ESSENCE_39095);
|
||||
|
||||
private static final int WILDERNESS_RESOURCE_AREA = 12605;
|
||||
private static final int MISCELLANIA = 10044;
|
||||
|
||||
Reference in New Issue
Block a user