mining plugin: track dense essence mining
Mining dense essense doesn't have a chat message so this starts the mining session based on animation instead. Co-authored-by: chasertw123 <henderson.chase@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -71,7 +72,7 @@ class MiningOverlay extends OverlayPanel
|
||||
}
|
||||
|
||||
Pickaxe pickaxe = plugin.getPickaxe();
|
||||
if (pickaxe != null && pickaxe.matchesMiningAnimation(client.getLocalPlayer()))
|
||||
if (pickaxe != null && (pickaxe.matchesMiningAnimation(client.getLocalPlayer()) || client.getLocalPlayer().getAnimation() == AnimationID.DENSE_ESSENCE_CHIPPING))
|
||||
{
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Mining")
|
||||
|
||||
@@ -34,6 +34,7 @@ import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
@@ -176,10 +177,24 @@ public class MiningPlugin extends Plugin
|
||||
}
|
||||
|
||||
int animId = local.getAnimation();
|
||||
Pickaxe pickaxe = Pickaxe.fromAnimation(animId);
|
||||
if (pickaxe != null)
|
||||
if (animId == AnimationID.DENSE_ESSENCE_CHIPPING)
|
||||
{
|
||||
this.pickaxe = pickaxe;
|
||||
// Can't use chat messages to start mining session on Dense Essence as they don't have a chat message when mined,
|
||||
// so we track the session here instead.
|
||||
if (session == null)
|
||||
{
|
||||
session = new MiningSession();
|
||||
}
|
||||
|
||||
session.setLastMined();
|
||||
}
|
||||
else
|
||||
{
|
||||
Pickaxe pickaxe = Pickaxe.fromAnimation(animId);
|
||||
if (pickaxe != null)
|
||||
{
|
||||
this.pickaxe = pickaxe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user