Merge pull request #4158 from Nightfirecat/fix-agility-pyramid-laps
Fix agility pyramid laps
This commit is contained in:
@@ -33,9 +33,9 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.ui.overlay.infobox.Timer;
|
import net.runelite.client.ui.overlay.infobox.Timer;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AgilityArenaTimer extends Timer
|
class AgilityArenaTimer extends Timer
|
||||||
{
|
{
|
||||||
public AgilityArenaTimer(Plugin plugin)
|
AgilityArenaTimer(Plugin plugin)
|
||||||
{
|
{
|
||||||
super(1, ChronoUnit.MINUTES, getTicketImage(), plugin);
|
super(1, ChronoUnit.MINUTES, getTicketImage(), plugin);
|
||||||
setTooltip("Time left until location changes");
|
setTooltip("Time left until location changes");
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
@@ -41,8 +40,7 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
@Slf4j
|
class AgilityOverlay extends Overlay
|
||||||
public class AgilityOverlay extends Overlay
|
|
||||||
{
|
{
|
||||||
private static final int MAX_DISTANCE = 2350;
|
private static final int MAX_DISTANCE = 2350;
|
||||||
|
|
||||||
@@ -51,7 +49,7 @@ public class AgilityOverlay extends Overlay
|
|||||||
private final AgilityConfig config;
|
private final AgilityConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AgilityOverlay(Client client, AgilityPlugin plugin, AgilityConfig config)
|
private AgilityOverlay(Client client, AgilityPlugin plugin, AgilityConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
@@ -72,7 +71,6 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
|||||||
description = "Show helpful information about agility courses and obstacles",
|
description = "Show helpful information about agility courses and obstacles",
|
||||||
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}
|
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}
|
||||||
)
|
)
|
||||||
@Slf4j
|
|
||||||
public class AgilityPlugin extends Plugin
|
public class AgilityPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
||||||
@@ -183,8 +181,9 @@ public class AgilityPlugin extends Plugin
|
|||||||
// Get course
|
// Get course
|
||||||
Courses course = Courses.getCourse(client.getLocalPlayer().getWorldLocation().getRegionID());
|
Courses course = Courses.getCourse(client.getLocalPlayer().getWorldLocation().getRegionID());
|
||||||
if (course == null
|
if (course == null
|
||||||
|| Math.abs(course.getLastObstacleXp() - skillGained) > 1
|
|| (course.getCourseEndWorldPoints().length == 0
|
||||||
|| (course.getCourseEndWorldPoints().length > 0 && Arrays.stream(course.getCourseEndWorldPoints()).noneMatch(wp -> wp.equals(client.getLocalPlayer().getWorldLocation()))))
|
? Math.abs(course.getLastObstacleXp() - skillGained) > 1
|
||||||
|
: Arrays.stream(course.getCourseEndWorldPoints()).noneMatch(wp -> wp.equals(client.getLocalPlayer().getWorldLocation()))))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,23 +33,21 @@ import net.runelite.api.Skill;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class AgilitySession
|
class AgilitySession
|
||||||
{
|
{
|
||||||
private final Courses course;
|
private final Courses course;
|
||||||
private Instant lastLapCompleted;
|
private Instant lastLapCompleted;
|
||||||
private int totalLaps;
|
private int totalLaps;
|
||||||
private int lapsTillLevel;
|
private int lapsTillLevel;
|
||||||
|
|
||||||
public AgilitySession(Courses course)
|
AgilitySession(Courses course)
|
||||||
{
|
{
|
||||||
this.course = course;
|
this.course = course;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementLapCount(Client client)
|
void incrementLapCount(Client client)
|
||||||
{
|
{
|
||||||
Instant now = Instant.now();
|
lastLapCompleted = Instant.now();
|
||||||
|
|
||||||
lastLapCompleted = now;
|
|
||||||
++totalLaps;
|
++totalLaps;
|
||||||
|
|
||||||
int currentExp = client.getSkillExperience(Skill.AGILITY);
|
int currentExp = client.getSkillExperience(Skill.AGILITY);
|
||||||
@@ -65,7 +63,7 @@ public class AgilitySession
|
|||||||
lapsTillLevel = remainingXp > 0 ? (int) Math.ceil(remainingXp / course.getTotalXp()) : 0;
|
lapsTillLevel = remainingXp > 0 ? (int) Math.ceil(remainingXp / course.getTotalXp()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetLapCount()
|
void resetLapCount()
|
||||||
{
|
{
|
||||||
totalLaps = 0;
|
totalLaps = 0;
|
||||||
lapsTillLevel = 0;
|
lapsTillLevel = 0;
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ import java.util.Map;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
|
||||||
public enum Courses
|
enum Courses
|
||||||
{
|
{
|
||||||
GNOME(86.5, 46, 9781),
|
GNOME(86.5, 46, 9781),
|
||||||
DRAYNOR(120.0, 79, 12338),
|
DRAYNOR(120.0, 79, 12338),
|
||||||
AL_KARID(180.0, 30, 13105, new WorldPoint(3299, 3194, 0)),
|
AL_KHARID(180.0, 30, 13105, new WorldPoint(3299, 3194, 0)),
|
||||||
PYRAMID(722.0, 300, 13356),
|
PYRAMID(722.0, 300, 13356, new WorldPoint(3364, 2830, 0)),
|
||||||
VARROCK(238.0, 125, 12853),
|
VARROCK(238.0, 125, 12853),
|
||||||
PENGUIN(540.0, 65, 10559),
|
PENGUIN(540.0, 65, 10559),
|
||||||
BARBARIAN(139.5, 60, 10039),
|
BARBARIAN(139.5, 60, 10039),
|
||||||
@@ -43,7 +43,7 @@ public enum Courses
|
|||||||
FALADOR(440, 180, 12084),
|
FALADOR(440, 180, 12084),
|
||||||
WILDERNESS(571.0, 499, 11837),
|
WILDERNESS(571.0, 499, 11837),
|
||||||
SEERS(570.0, 435, 10806),
|
SEERS(570.0, 435, 10806),
|
||||||
POLLNIVEACH(890.0, 540, 13358),
|
POLLNIVNEACH(890.0, 540, 13358),
|
||||||
RELLEKA(780.0, 475, 10553),
|
RELLEKA(780.0, 475, 10553),
|
||||||
ARDOUGNE(793.0, 529, 10547);
|
ARDOUGNE(793.0, 529, 10547);
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public enum Courses
|
|||||||
this.courseEndWorldPoints = courseEndWorldPoints;
|
this.courseEndWorldPoints = courseEndWorldPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Courses getCourse(int regionId)
|
static Courses getCourse(int regionId)
|
||||||
{
|
{
|
||||||
return coursesByRegion.get(regionId);
|
return coursesByRegion.get(regionId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.OverlayPriority;
|
|||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
public class LapCounterOverlay extends Overlay
|
class LapCounterOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private final AgilityPlugin plugin;
|
private final AgilityPlugin plugin;
|
||||||
private final AgilityConfig config;
|
private final AgilityConfig config;
|
||||||
@@ -43,7 +43,7 @@ public class LapCounterOverlay extends Overlay
|
|||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
LapCounterOverlay(AgilityPlugin plugin, AgilityConfig config)
|
private LapCounterOverlay(AgilityPlugin plugin, AgilityConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.TOP_LEFT);
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
setPriority(OverlayPriority.LOW);
|
setPriority(OverlayPriority.LOW);
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ import java.util.Set;
|
|||||||
import static net.runelite.api.ObjectID.*;
|
import static net.runelite.api.ObjectID.*;
|
||||||
import static net.runelite.api.NullObjectID.*;
|
import static net.runelite.api.NullObjectID.*;
|
||||||
|
|
||||||
public class Obstacles
|
class Obstacles
|
||||||
{
|
{
|
||||||
public static final Set<Integer> COURSE_OBSTACLE_IDS = ImmutableSet.of(
|
static final Set<Integer> COURSE_OBSTACLE_IDS = ImmutableSet.of(
|
||||||
// Gnome
|
// Gnome
|
||||||
OBSTACLE_NET_23134, TREE_BRANCH_23559, TREE_BRANCH_23560, OBSTACLE_NET_23135, OBSTACLE_PIPE_23138,
|
OBSTACLE_NET_23134, TREE_BRANCH_23559, TREE_BRANCH_23560, OBSTACLE_NET_23135, OBSTACLE_PIPE_23138,
|
||||||
OBSTACLE_PIPE_23139, LOG_BALANCE_23145, BALANCING_ROPE_23557,
|
OBSTACLE_PIPE_23139, LOG_BALANCE_23145, BALANCING_ROPE_23557,
|
||||||
@@ -79,7 +79,7 @@ public class Obstacles
|
|||||||
GAP_11406, GAP_11429, GAP_11430, STEEP_ROOF, GAP_11630, PLANK_11631, WOODEN_BEAMS
|
GAP_11406, GAP_11429, GAP_11430, STEEP_ROOF, GAP_11630, PLANK_11631, WOODEN_BEAMS
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final Set<Integer> SHORTCUT_OBSTACLE_IDS = ImmutableSet.of(
|
static final Set<Integer> SHORTCUT_OBSTACLE_IDS = ImmutableSet.of(
|
||||||
// Grand Exchange
|
// Grand Exchange
|
||||||
UNDERWALL_TUNNEL_16529, UNDERWALL_TUNNEL_16530,
|
UNDERWALL_TUNNEL_16529, UNDERWALL_TUNNEL_16530,
|
||||||
// South Varrock
|
// South Varrock
|
||||||
@@ -192,10 +192,10 @@ public class Obstacles
|
|||||||
CLIMBING_ROCKS_11948, CLIMBING_ROCKS_11949
|
CLIMBING_ROCKS_11948, CLIMBING_ROCKS_11949
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final Set<Integer> TRAP_OBSTACLE_IDS = ImmutableSet.of(
|
static final Set<Integer> TRAP_OBSTACLE_IDS = ImmutableSet.of(
|
||||||
// Agility pyramid
|
// Agility pyramid
|
||||||
NULL_3550, NULL_10872, NULL_10873
|
NULL_3550, NULL_10872, NULL_10873
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final List<Integer> TRAP_OBSTACLE_REGIONS = ImmutableList.of(12105, 13356);
|
static final List<Integer> TRAP_OBSTACLE_REGIONS = ImmutableList.of(12105, 13356);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user