fishing: Check player animation to update fishing status

This commit adds an animation check to the other fishing status checks
already present in the fishing overlay (interacting and fishing spot NPC
name check) to ensure that the status correctly changes to "NOT fishing"
when the player's fishing animation is interrupted by certain actions
such as being presented with a level-up dialog. This commit causes one
other behavioral change as a side effect, which is that the player's
fishing status will be "NOT fishing" while running toward a distant
fishing spot until they reach it and start their fishing animation.

Fixes runelite/runelite#10900
This commit is contained in:
Brandt Hill
2020-03-13 19:15:40 -07:00
committed by Jordan Atwood
parent a0ba612219
commit eb09879205
2 changed files with 35 additions and 1 deletions

View File

@@ -27,7 +27,10 @@ package net.runelite.client.plugins.fishing;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.util.Set;
import javax.inject.Inject;
import com.google.common.collect.ImmutableSet;
import net.runelite.api.AnimationID;
import net.runelite.api.Client;
import net.runelite.api.GraphicID;
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY;
@@ -47,6 +50,28 @@ class FishingOverlay extends Overlay
private static final String FISHING_SPOT = "Fishing spot";
static final String FISHING_RESET = "Reset";
private static final Set<Integer> FISHING_ANIMATIONS = ImmutableSet.of(
AnimationID.FISHING_BARBTAIL_HARPOON,
AnimationID.FISHING_BAREHAND,
AnimationID.FISHING_BAREHAND_CAUGHT_SHARK_1,
AnimationID.FISHING_BAREHAND_CAUGHT_SHARK_2,
AnimationID.FISHING_BAREHAND_CAUGHT_SWORDFISH_1,
AnimationID.FISHING_BAREHAND_CAUGHT_SWORDFISH_2,
AnimationID.FISHING_BAREHAND_CAUGHT_TUNA_1,
AnimationID.FISHING_BAREHAND_CAUGHT_TUNA_2,
AnimationID.FISHING_BAREHAND_WINDUP_1,
AnimationID.FISHING_BAREHAND_WINDUP_2,
AnimationID.FISHING_BIG_NET,
AnimationID.FISHING_CAGE,
AnimationID.FISHING_CRYSTAL_HARPOON,
AnimationID.FISHING_DRAGON_HARPOON,
AnimationID.FISHING_HARPOON,
AnimationID.FISHING_INFERNAL_HARPOON,
AnimationID.FISHING_KARAMBWAN,
AnimationID.FISHING_NET,
AnimationID.FISHING_OILY_ROD,
AnimationID.FISHING_POLE_CAST);
private final Client client;
private final FishingPlugin plugin;
private final FishingConfig config;
@@ -78,7 +103,8 @@ class FishingOverlay extends Overlay
panelComponent.getChildren().clear();
if (client.getLocalPlayer().getInteracting() != null
&& client.getLocalPlayer().getInteracting().getName().contains(FISHING_SPOT)
&& client.getLocalPlayer().getInteracting().getGraphic() != GraphicID.FLYING_FISH)
&& client.getLocalPlayer().getInteracting().getGraphic() != GraphicID.FLYING_FISH
&& FISHING_ANIMATIONS.contains(client.getLocalPlayer().getAnimation()))
{
panelComponent.getChildren().add(TitleComponent.builder()
.text("Fishing")