Skip to content

Commit

Permalink
mining plugin: track dense essence mining
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adam- and chasertw123 committed Sep 13, 2020
1 parent 754fbf2 commit 5a52447
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Expand Up @@ -28,6 +28,7 @@
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;
Expand Down Expand Up @@ -71,7 +72,7 @@ public Dimension render(Graphics2D graphics)
}

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")
Expand Down
Expand Up @@ -34,6 +34,7 @@
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;
Expand Down Expand Up @@ -176,10 +177,24 @@ public void onAnimationChanged(final AnimationChanged event)
}

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;
}
}
}

Expand Down

0 comments on commit 5a52447

Please sign in to comment.