volcanic mine plugin: show optimal paths
Add gas chamber rock timer
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.volcanicminehelper;
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017. l2-
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
class OptimalPaths
|
||||||
|
{
|
||||||
|
private static final int INSTANCE_SIZE = 192;
|
||||||
|
|
||||||
|
private static final Set<Point> OPTIMAL_PATH_POINTS = ImmutableSet.of(
|
||||||
|
new Point(161, 145),
|
||||||
|
new Point(161, 144),
|
||||||
|
new Point(161, 143),
|
||||||
|
new Point(161, 142),
|
||||||
|
new Point(169, 151),
|
||||||
|
new Point(169, 148),
|
||||||
|
new Point(169, 147),
|
||||||
|
new Point(169, 133),
|
||||||
|
new Point(175, 146),
|
||||||
|
new Point(176, 146),
|
||||||
|
new Point(179, 116),
|
||||||
|
new Point(179, 117),
|
||||||
|
new Point(179, 118),
|
||||||
|
new Point(167, 101),
|
||||||
|
new Point(167, 100),
|
||||||
|
new Point(167, 104),
|
||||||
|
new Point(167, 105),
|
||||||
|
new Point(166, 76),
|
||||||
|
new Point(166, 77),
|
||||||
|
new Point(166, 78),
|
||||||
|
new Point(166, 79),
|
||||||
|
new Point(146, 107),
|
||||||
|
new Point(145, 107),
|
||||||
|
new Point(144, 107),
|
||||||
|
new Point(143, 107),
|
||||||
|
new Point(142, 107),
|
||||||
|
new Point(141, 107),
|
||||||
|
new Point(139, 104),
|
||||||
|
new Point(139, 103),
|
||||||
|
new Point(139, 102),
|
||||||
|
new Point(139, 101),
|
||||||
|
new Point(152, 101),
|
||||||
|
new Point(152, 100),
|
||||||
|
new Point(149, 76)
|
||||||
|
);
|
||||||
|
|
||||||
|
public final static Set<Point> BOULDER_RANGE_POINTS = ImmutableSet.of(
|
||||||
|
new Point(162, 123),
|
||||||
|
new Point(161, 152),
|
||||||
|
new Point(160, 151),
|
||||||
|
new Point(163, 105),
|
||||||
|
new Point(163, 104),
|
||||||
|
new Point(163, 103),
|
||||||
|
new Point(163, 102),
|
||||||
|
new Point(163, 101),
|
||||||
|
new Point(164, 92),
|
||||||
|
new Point(164, 91),
|
||||||
|
new Point(164, 90),
|
||||||
|
new Point(164, 83),
|
||||||
|
new Point(165, 80),
|
||||||
|
new Point(164, 80),
|
||||||
|
new Point(155, 80),
|
||||||
|
new Point(155, 81),
|
||||||
|
new Point(155, 82),
|
||||||
|
new Point(155, 83),
|
||||||
|
new Point(155, 89),
|
||||||
|
new Point(155, 90),
|
||||||
|
new Point(155, 91),
|
||||||
|
new Point(155, 92),
|
||||||
|
new Point(156, 103),
|
||||||
|
new Point(156, 104),
|
||||||
|
new Point(156, 105),
|
||||||
|
new Point(162, 126),
|
||||||
|
new Point(162, 125),
|
||||||
|
new Point(162, 124)
|
||||||
|
);
|
||||||
|
|
||||||
|
//only use global location
|
||||||
|
public static boolean isOptimalPathTile(Point point)
|
||||||
|
{
|
||||||
|
Point instanceLocation = new Point(point.getX() % INSTANCE_SIZE, point.getY() % INSTANCE_SIZE);
|
||||||
|
return OPTIMAL_PATH_POINTS.contains(instanceLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
//only use global location
|
||||||
|
public static boolean isBoulderRangeTile(Point point)
|
||||||
|
{
|
||||||
|
Point instanceLocation = new Point(point.getX() % INSTANCE_SIZE, point.getY() % INSTANCE_SIZE);
|
||||||
|
return BOULDER_RANGE_POINTS.contains(instanceLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.volcanicminehelper;
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
@@ -94,6 +94,28 @@ public interface VolcanicMineConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
position = 5,
|
||||||
|
keyName = "timerOverlay",
|
||||||
|
name = "timer overlay",
|
||||||
|
description = "The overlay showing the timers"
|
||||||
|
)
|
||||||
|
default boolean timerOverlay()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
|
keyName = "optimalPathOverlay",
|
||||||
|
name = "show optimal Paths",
|
||||||
|
description = "The overlay showing the optimal paths"
|
||||||
|
)
|
||||||
|
default boolean optimalPaths()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 7,
|
||||||
keyName = "platformColorLow",
|
keyName = "platformColorLow",
|
||||||
name = "PlatformColor low risk",
|
name = "PlatformColor low risk",
|
||||||
description = "Configures the color for the platformOverlay"
|
description = "Configures the color for the platformOverlay"
|
||||||
@@ -104,7 +126,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 6,
|
position = 8,
|
||||||
keyName = "platformColorMed",
|
keyName = "platformColorMed",
|
||||||
name = "PlatformColor med risk",
|
name = "PlatformColor med risk",
|
||||||
description = "Configures the color for the platformOverlay"
|
description = "Configures the color for the platformOverlay"
|
||||||
@@ -115,7 +137,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 7,
|
position = 9,
|
||||||
keyName = "platformColorHigh",
|
keyName = "platformColorHigh",
|
||||||
name = "PlatformColor high risk",
|
name = "PlatformColor high risk",
|
||||||
description = "Configures the color for the platformOverlay"
|
description = "Configures the color for the platformOverlay"
|
||||||
@@ -126,7 +148,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 8,
|
position = 10,
|
||||||
keyName = "platformTimerThreshold",
|
keyName = "platformTimerThreshold",
|
||||||
name = "Platform timer notification threshold",
|
name = "Platform timer notification threshold",
|
||||||
description = "At what time does the plugin notify (in seconds), set to -1 to disable"
|
description = "At what time does the plugin notify (in seconds), set to -1 to disable"
|
||||||
@@ -137,7 +159,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 9,
|
position = 11,
|
||||||
keyName = "timeLeftThreshold",
|
keyName = "timeLeftThreshold",
|
||||||
name = "Time left threshold",
|
name = "Time left threshold",
|
||||||
description = "At what time does the plugin notify (in seconds), set to -1 to disable"
|
description = "At what time does the plugin notify (in seconds), set to -1 to disable"
|
||||||
@@ -148,7 +170,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 9,
|
position = 12,
|
||||||
keyName = "stabilityThreshold",
|
keyName = "stabilityThreshold",
|
||||||
name = "Stability threshold",
|
name = "Stability threshold",
|
||||||
description = "At what stability does the plugin notify (in percentage), set to -1 to disable"
|
description = "At what stability does the plugin notify (in percentage), set to -1 to disable"
|
||||||
@@ -159,7 +181,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 10,
|
position = 13,
|
||||||
keyName = "prayer",
|
keyName = "prayer",
|
||||||
name = "Prayer warning",
|
name = "Prayer warning",
|
||||||
description = "Protect prayer warning setting"
|
description = "Protect prayer warning setting"
|
||||||
@@ -170,7 +192,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 11,
|
position = 14,
|
||||||
keyName = "hotTiles",
|
keyName = "hotTiles",
|
||||||
name = "Hot Tile warning",
|
name = "Hot Tile warning",
|
||||||
description = "Hot tile warning setting"
|
description = "Hot tile warning setting"
|
||||||
@@ -181,7 +203,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 12,
|
position = 15,
|
||||||
keyName = "timerWarning",
|
keyName = "timerWarning",
|
||||||
name = "timer warning",
|
name = "timer warning",
|
||||||
description = "timer low warning setting"
|
description = "timer low warning setting"
|
||||||
@@ -192,7 +214,7 @@ public interface VolcanicMineConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 13,
|
position = 16,
|
||||||
keyName = "stabilityWarning",
|
keyName = "stabilityWarning",
|
||||||
name = "stability warning",
|
name = "stability warning",
|
||||||
description = "stability low warning setting"
|
description = "stability low warning setting"
|
||||||
@@ -23,13 +23,14 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.volcanicminehelper;
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -41,6 +42,7 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Prayer;
|
import net.runelite.api.Prayer;
|
||||||
import net.runelite.api.Region;
|
import net.runelite.api.Region;
|
||||||
@@ -54,23 +56,24 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
public class VolcanicMineOverlay extends Overlay
|
public class VolcanicMineOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(VolcanicMineHelperPlugin.class);
|
private static final Logger logger = LoggerFactory.getLogger(VolcanicMinePlugin.class);
|
||||||
|
|
||||||
private static final int THRESH_LOW = 45;
|
private static final int THRESH_LOW = 45;
|
||||||
private static final int THRESH_MED = 5;
|
private static final int THRESH_MED = 5;
|
||||||
|
|
||||||
|
private static final int MAX_DISTANCE = 19; //2400/128 rounded up
|
||||||
private static final int REGION_SIZE = 104;
|
private static final int REGION_SIZE = 104;
|
||||||
private static final int Z_OFFSET_TIMER = 25;
|
private static final int Z_OFFSET_TIMER = 25;
|
||||||
private static final String PROTECT_MESSAGE = "Protect!";
|
private static final String PROTECT_MESSAGE = "Protect!";
|
||||||
|
|
||||||
private final VolcanicMineHelperPlugin plugin;
|
private final VolcanicMinePlugin plugin;
|
||||||
private final VolcanicMineConfig config;
|
private final VolcanicMineConfig config;
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private Image protectFromMissilesImg;
|
private Image protectFromMissilesImg;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VolcanicMineOverlay(@Nullable Client client, VolcanicMineHelperPlugin plugin, VolcanicMineConfig config)
|
VolcanicMineOverlay(@Nullable Client client, VolcanicMinePlugin plugin, VolcanicMineConfig config)
|
||||||
{
|
{
|
||||||
super(OverlayPosition.DYNAMIC);
|
super(OverlayPosition.DYNAMIC);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
@@ -142,12 +145,45 @@ public class VolcanicMineOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
renderPaths(graphics, tile);
|
||||||
renderGameObjects(graphics, tile);
|
renderGameObjects(graphics, tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderPaths(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
if (config.optimalPaths() && !plugin.getObjectTimerMap().containsKey(tile))
|
||||||
|
{
|
||||||
|
Point worldLoc = tile.getWorldLocation();
|
||||||
|
if (client.getLocalPlayer().getWorldLocation().distanceTo(worldLoc) > MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OptimalPaths.isOptimalPathTile(worldLoc))
|
||||||
|
{
|
||||||
|
Point localTile = tile.getLocalLocation();
|
||||||
|
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, Color.CYAN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (OptimalPaths.isBoulderRangeTile(worldLoc))
|
||||||
|
{
|
||||||
|
Point localTile = tile.getLocalLocation();
|
||||||
|
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, Color.MAGENTA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void renderGameObjects(Graphics2D graphics, Tile tile)
|
private void renderGameObjects(Graphics2D graphics, Tile tile)
|
||||||
{
|
{
|
||||||
GameObject[] gameObjects = tile.getGameObjects();
|
GameObject[] gameObjects = tile.getGameObjects();
|
||||||
@@ -155,10 +191,9 @@ public class VolcanicMineOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (GameObject gameObject : gameObjects)
|
for (GameObject gameObject : gameObjects)
|
||||||
{
|
{
|
||||||
if (gameObject != null && plugin.getObjectTimerMap().containsKey(tile))
|
if (gameObject != null && plugin.getObjectTimerMap().containsKey(tile) && config.timerOverlay())
|
||||||
{
|
{
|
||||||
Duration duration = Duration.between(Instant.now(), plugin.getObjectTimerMap().get(tile));
|
Duration duration = Duration.between(Instant.now(), plugin.getObjectTimerMap().get(tile));
|
||||||
if (!duration.isNegative())
|
if (!duration.isNegative())
|
||||||
@@ -169,7 +204,7 @@ public class VolcanicMineOverlay extends Overlay
|
|||||||
Color color;
|
Color color;
|
||||||
if (seconds > THRESH_LOW)
|
if (seconds > THRESH_LOW)
|
||||||
{
|
{
|
||||||
color = config.platformColorLow();;
|
color = config.platformColorLow();
|
||||||
}
|
}
|
||||||
else if (seconds > THRESH_MED)
|
else if (seconds > THRESH_MED)
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.volcanicminehelper;
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
@@ -67,13 +67,16 @@ import net.runelite.api.queries.NPCQuery;
|
|||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Volcanic mine helper"
|
name = "Volcanic mine helper"
|
||||||
)
|
)
|
||||||
public class VolcanicMineHelperPlugin extends Plugin
|
public class VolcanicMinePlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(VolcanicMineHelperPlugin.class);
|
private static final Logger logger = LoggerFactory.getLogger(VolcanicMinePlugin.class);
|
||||||
private static final int REGION_SIZE = 104;
|
private static final int REGION_SIZE = 104;
|
||||||
private static final int MAX_DISTANCE = 2400;
|
private static final int MAX_DISTANCE = 2400;
|
||||||
private static final int LAVA_ID = 30997;
|
private static final int LAVA_ID = 30997;
|
||||||
private static final int LAVA_BEAST_ATTACK_RANGE = 1400;
|
private static final int LAVA_BEAST_ATTACK_RANGE = 1400;
|
||||||
|
private static final int GAS_CHAMBER_ROCK_ID = 31045;
|
||||||
|
private static final int GAS_CHAMBER_NO_ROCK_ID = 31046;
|
||||||
|
private static final int GAS_CHAMBER_ROCK_RESPAWN_TIMER = 15;
|
||||||
private static final String LAVA_BEAST = "Lava beast";
|
private static final String LAVA_BEAST = "Lava beast";
|
||||||
private static final Pattern coltagPattern = Pattern.compile("((<col=([0-f]){6}>)|(<\\/col>))");
|
private static final Pattern coltagPattern = Pattern.compile("((<col=([0-f]){6}>)|(<\\/col>))");
|
||||||
|
|
||||||
@@ -263,7 +266,7 @@ public class VolcanicMineHelperPlugin extends Plugin
|
|||||||
private boolean isInside()
|
private boolean isInside()
|
||||||
{
|
{
|
||||||
Widget widget = client.getWidget(WidgetInfo.VOLCANICMINE_GENERAL_INFOBOX_GROUP);
|
Widget widget = client.getWidget(WidgetInfo.VOLCANICMINE_GENERAL_INFOBOX_GROUP);
|
||||||
return widget != null && !widget.isHidden();
|
return widget != null && !widget.isHidden() && client.getPlane() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean lavaBeastInRange(Player player)
|
private boolean lavaBeastInRange(Player player)
|
||||||
@@ -322,12 +325,12 @@ public class VolcanicMineHelperPlugin extends Plugin
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lookForPlatforms(tile, player);
|
lookForGameObjects(tile, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lookForPlatforms(Tile tile, Player player)
|
private void lookForGameObjects(Tile tile, Player player)
|
||||||
{
|
{
|
||||||
Point playerLocation = player.getLocalLocation();
|
Point playerLocation = player.getLocalLocation();
|
||||||
GameObject[] gameObjects = tile.getGameObjects();
|
GameObject[] gameObjects = tile.getGameObjects();
|
||||||
@@ -342,27 +345,36 @@ public class VolcanicMineHelperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LavaPlatform lavaPlatform = LavaPlatform.fromId(gameObject.getId());
|
|
||||||
Point objectLocation = gameObject.getLocalLocation();
|
Point objectLocation = gameObject.getLocalLocation();
|
||||||
|
|
||||||
if (lavaPlatform == null
|
if (abs(playerLocation.getX() - objectLocation.getX()) < MAX_DISTANCE
|
||||||
|| abs(playerLocation.getX() - objectLocation.getX()) > MAX_DISTANCE
|
&& abs(playerLocation.getY() - objectLocation.getY()) < MAX_DISTANCE)
|
||||||
|| abs(playerLocation.getY() - objectLocation.getY()) > MAX_DISTANCE)
|
|
||||||
{
|
{
|
||||||
continue;
|
LavaPlatform lavaPlatform = LavaPlatform.fromId(gameObject.getId());
|
||||||
}
|
Instant now = Instant.now();
|
||||||
|
Instant vanishTime;
|
||||||
|
|
||||||
Instant now = Instant.now();
|
if (lavaPlatform != null)
|
||||||
Instant vanishTime = now.plus(lavaPlatform.getTime());
|
|
||||||
|
|
||||||
Instant returnInstant = objectTimerMap.putIfAbsent(tile, vanishTime);
|
|
||||||
if (returnInstant != null)
|
|
||||||
{
|
|
||||||
if (returnInstant.isBefore(now)
|
|
||||||
|| vanishTime.isBefore(returnInstant))
|
|
||||||
{
|
{
|
||||||
objectTimerMap.replace(tile, vanishTime);
|
vanishTime = now.plus(lavaPlatform.getTime());
|
||||||
|
}
|
||||||
|
else if (gameObject.getId() == GAS_CHAMBER_NO_ROCK_ID)
|
||||||
|
{
|
||||||
|
vanishTime = now.plus(Duration.ofSeconds(GAS_CHAMBER_ROCK_RESPAWN_TIMER));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instant returnInstant = objectTimerMap.putIfAbsent(tile, vanishTime);
|
||||||
|
if (returnInstant != null)
|
||||||
|
{
|
||||||
|
if (returnInstant.isBefore(now)
|
||||||
|
|| vanishTime.isBefore(returnInstant))
|
||||||
|
{
|
||||||
|
objectTimerMap.replace(tile, vanishTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,7 +385,7 @@ public class VolcanicMineHelperPlugin extends Plugin
|
|||||||
//remove the timers which hit 0
|
//remove the timers which hit 0
|
||||||
objectTimerMap = objectTimerMap.entrySet().stream()
|
objectTimerMap = objectTimerMap.entrySet().stream()
|
||||||
.filter(entry -> Instant.now().isBefore(entry.getValue()))
|
.filter(entry -> Instant.now().isBefore(entry.getValue()))
|
||||||
.filter(v -> v.getKey().getGameObjects() != null && v.getKey().getGameObjects()[0] != null && v.getKey().getGameObjects()[0].getId() != LAVA_ID)
|
.filter(v -> v.getKey().getGameObjects() != null && v.getKey().getGameObjects()[0] != null && v.getKey().getGameObjects()[0].getId() != LAVA_ID && v.getKey().getGameObjects()[0].getId() != GAS_CHAMBER_ROCK_ID)
|
||||||
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
|
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.volcanicminehelper;
|
package net.runelite.client.plugins.volcanicmine;
|
||||||
|
|
||||||
public enum WarningMode
|
public enum WarningMode
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user