This commit is contained in:
James Munson
2019-04-24 17:22:33 -07:00
21 changed files with 612 additions and 212 deletions

View File

@@ -1391,6 +1391,7 @@ public interface Client extends GameEngine
*/
void setClanMatesHidden(boolean state);
/**
* Sets whether the local player is hidden.
*
@@ -1610,4 +1611,7 @@ public interface Client extends GameEngine
void draw2010Menu();
NodeCache getHealthBarCache();
void invokeMenuAction(int var1, int var2, int var3, int var4, String var5, String var6, int var7, int var8);
}

View File

@@ -1566,4 +1566,7 @@ public final class SpriteID
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_2 = 1626;
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS_UNUSED = 1708;
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS = 1711;
public static final int BIG_ASS_GUTHIX_SPELL = 1774;
public static final int BIG_SUPERHEAT = 1800;
public static final int BIG_SPEC_TRANSFER = 1959;
}

View File

@@ -1002,4 +1002,30 @@ static final int WIND_STRIKE = 5;
static final int CUSTOM_TEXT_CONTAINER = 33;
}
public static class TradeScreen {
public static final int SECOND_GROUP_ID = 334;
public static final int SECOND_TRADING_WITH = 30;
public static final int SECOND_MY_OFFER = 23;
public static final int SECOND_THEIR_OFFER = 24;
public static final int SECOND_ACCEPT_FUNC = 13;
public static final int SECOND_ACCEPT_TEXT = 25;
}
public static class DuelConfig {
public static final int CONFIG_GROUP_IP = 482;
public static final int TITLE = 35;
public static final int OPPONENT_ATT = 9;
public static final int OPPONENT_STR = 13;
public static final int OPPONENT_DEF = 17;
public static final int OPPONENT_HP = 21;
}
public static class DuelResult {
public static final int RESULT_GROUP_ID = 372;
public static final int TITLE = 16;
public static final int TOTAL_STAKED = 32;
public static final int TOTAL_TAX = 39;
public static final int WINNINGS = 40;
}
}

View File

@@ -24,16 +24,16 @@
*/
package net.runelite.client.plugins.antidrag;
import java.awt.Color;
import java.awt.event.KeyEvent;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Keybind;
import net.runelite.client.config.ModifierlessKeybind;
/*@ConfigGroup(
keyName = "antiDrag",
name = "Anti Drag",
description = "Configuration for the anti drag plugin"
)*/
@ConfigGroup("antidrag")
@ConfigGroup("antiDrag")
public interface AntiDragConfig extends Config
{
@ConfigItem(
@@ -46,4 +46,49 @@ public interface AntiDragConfig extends Config
{
return 600 / 20; // one game tick
}
@ConfigItem(
keyName = "keybind",
name = "keybind",
description = "The keybind you want to use for antidrag",
position = 2
)
default Keybind key()
{
return new ModifierlessKeybind(KeyEvent.VK_SHIFT, 0);
}
@ConfigItem(
keyName = "reqfocus",
name = "Reset on focus loss",
description = "Disable antidrag when losing focus (like alt tabbing)",
position = 3
)
default boolean reqfocus()
{
return false;
}
@ConfigItem(
keyName = "overlay",
name = "Enable overlay",
description = "Do you really need a description?",
position = 4
)
default boolean overlay()
{
return true;
}
@Alpha
@ConfigItem(
keyName = "color",
name = "Overlay color",
description = "Change the overlay color, duh",
position = 5
)
default Color color()
{
return new Color(255, 0, 0, 30);
}
}

View File

@@ -0,0 +1,47 @@
package net.runelite.client.plugins.antidrag;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import net.runelite.api.Client;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
@Singleton
public class AntiDragOverlay extends Overlay
{
private static final int RADIUS = 20;
private Client client;
private AntiDragConfig config;
@Inject
private AntiDragOverlay(Client client, AntiDragConfig config)
{
this.config = config;
this.client = client;
setPosition(OverlayPosition.TOOLTIP);
setPriority(OverlayPriority.HIGHEST);
setLayer(OverlayLayer.ALWAYS_ON_TOP);
}
@Override
public Dimension render(Graphics2D g)
{
final Color color = config.color();
g.setColor(color);
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
final Point mousePosition = new Point(mouseCanvasPosition.getX() - RADIUS, mouseCanvasPosition.getY() - RADIUS);
final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, 2 * RADIUS, 2 * RADIUS);
g.fillOval(bounds.x, bounds.y, bounds.height, bounds.width);
return bounds.getSize();
}
}

View File

@@ -24,26 +24,30 @@
*/
package net.runelite.client.plugins.antidrag;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Provides;
import java.awt.event.KeyEvent;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.events.FocusChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.input.KeyListener;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.HotkeyListener;
@PluginDescriptor(
name = "Anti Drag",
type = PluginType.UTILITY,
enabledByDefault = false)
public class AntiDragPlugin extends Plugin implements KeyListener
name = "Shift Anti Drag",
description = "Prevent dragging an item for a specified delay",
tags = {"antidrag", "delay", "inventory", "items"},
type = PluginType.UTILITY,
enabledByDefault = false
)
public class AntiDragPlugin extends Plugin
{
private static final int DEFAULT_DELAY = 5;
private boolean toggleDrag;
@Inject
private Client client;
@@ -51,6 +55,12 @@ public class AntiDragPlugin extends Plugin implements KeyListener
@Inject
private AntiDragConfig config;
@Inject
private AntiDragOverlay overlay;
@Inject
private OverlayManager overlayManager;
@Inject
private KeyManager keyManager;
@@ -63,57 +73,50 @@ public class AntiDragPlugin extends Plugin implements KeyListener
@Override
protected void startUp() throws Exception
{
client.setInventoryDragDelay(config.dragDelay());
keyManager.registerKeyListener(this);
keyManager.registerKeyListener(hotkeyListener);
toggleDrag = false;
}
@Override
protected void shutDown() throws Exception
{
client.setInventoryDragDelay(DEFAULT_DELAY);
keyManager.unregisterKeyListener(this);
keyManager.unregisterKeyListener(hotkeyListener);
toggleDrag = false;
overlayManager.remove(overlay);
}
@Override
public void keyTyped(KeyEvent e)
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.key())
{
}
public boolean toggleDrag = true;
@Override
public void keyPressed(KeyEvent e)
{
/*if (e.getKeyCode() == KeyEvent.VK_SHIFT)
@Override
public void hotkeyPressed()
{
client.setInventoryDragDelay(config.dragDelay());
toggleDrag = !toggleDrag;
if (toggleDrag)
{
if (config.overlay())
{
overlayManager.add(overlay);
}
client.setInventoryDragDelay(config.dragDelay());
}
else
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
}
}
client.setInventoryDragDelay(config.dragDelay());*/
}
};
@Override
public void keyReleased(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_CONTROL && toggleDrag) {
toggleDrag = false;
client.setInventoryDragDelay(DEFAULT_DELAY);
} else if (e.getKeyCode() == KeyEvent.VK_CONTROL && !toggleDrag) {
toggleDrag = true;
client.setInventoryDragDelay(config.dragDelay());
}
}
/*@Subscribe
@Subscribe
public void onFocusChanged(FocusChanged focusChanged)
{
if (!focusChanged.isFocused())
if (!focusChanged.isFocused() && config.reqfocus())
{
client.setInventoryDragDelay(DEFAULT_DELAY);
overlayManager.remove(overlay);
}
}*/
}
}

View File

@@ -57,6 +57,7 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ImageUtil;
@@ -64,7 +65,8 @@ import net.runelite.client.util.ImageUtil;
@PluginDescriptor(
name = "Barbarian Assault",
description = "Show a timer to the next call change and game/wave duration in chat.",
tags = {"minigame", "overlay", "timer"}
tags = {"minigame", "overlay", "timer"},
type = PluginType.PVM
)
public class BarbarianAssaultPlugin extends Plugin {
private static final int BA_WAVE_NUM_INDEX = 2;

View File

@@ -1,162 +0,0 @@
package net.runelite.client.plugins.example;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.util.EnumSet;
import java.util.HashSet;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.ItemID;
import net.runelite.api.Point;
import net.runelite.api.SpriteID;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit;
import net.runelite.client.ui.overlay.arrow.ArrowPoint;
import net.runelite.client.ui.overlay.arrow.ArrowPointManager;
import net.runelite.client.ui.overlay.arrow.ArrowType;
@PluginDescriptor(
name = "ArrowTest",
developerPlugin = true
)
public class ExamplePlugin extends Plugin
{
@Inject
private ArrowPointManager arrowPointManager;
@Inject
private SpriteManager spriteManager;
@Inject
private ItemManager itemManager;
@Inject
private Client client;
@Inject
private ClientThread clientThread;
private boolean firstLogin = true;
@Override
public void startUp() throws Exception
{
clientThread.invokeLater(this::loadArrows);
}
@Override
public void shutDown()
{
arrowPointManager.clear();
}
public void loadArrows()
{
if (client.getGameState() != GameState.LOGGED_IN)
{
return;
}
BufferedImage i = spriteManager.getSprite(SpriteID.MINIMAP_GUIDE_ARROW_YELLOW, 0);
BufferedImage i3 = spriteManager.getSprite(SpriteID.RED_GUIDE_ARROW, 0);
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -i3.getHeight()));
BufferedImage i4 = new BufferedImage(i3.getWidth(), i3.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = i4.createGraphics();
g.transform(at);
g.drawImage(i3, 0, 0, null);
g.dispose();
Point i3Offset = new Point(0, i3.getHeight() / -2);
ArrowPoint one = ArrowPoint.builder()
.worldPoint(new WorldPoint(1554, 3551, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.WORLD_POINT))
.build();
//arrowPointManager.add(this, one);
ArrowPoint two = ArrowPoint.builder()
.worldPoint(new WorldPoint(1544, 3580, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.WORLD_POINT))
.build();
//arrowPointManager.add(this, two);
ArrowPoint three = ArrowPoint.builder()
.worldPoint(new WorldPoint(1571, 3541, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.WORLD_POINT))
.build();
//arrowPointManager.add(this, three);
HashSet<Integer> NPCs = new HashSet<>();
NPCs.add(6910);
ArrowPoint npcone = ArrowPoint.builder()
.worldPoint(new WorldPoint(1545, 3595, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.npcIDs(NPCs)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.NPC))
.build();
//arrowPointManager.add(this, npcone);
HashSet<Integer> NPCs2 = new HashSet<>();
NPCs2.add(6889);
NPCs2.add(6883);
NPCs2.add(6885);
ArrowPoint npctwo = ArrowPoint.builder()
.worldPoint(new WorldPoint(1551, 3561, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.worldImageOffset(new Point(0, -i4.getHeight()))
.npcIDs(NPCs2)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.NPC))
.build();
//arrowPointManager.add(this, npctwo);
HashSet<Integer> OBJs = new HashSet<>();
OBJs.add(STASHUnit.SHAYZIEN_WAR_TENT);
ArrowPoint objone = ArrowPoint.builder()
.worldPoint(new WorldPoint(1550, 3541, 0))
.minimapImage(i4)
.worldImage(i)
.minimapImageOffset(i3Offset)
.worldImageOffset(new Point(0, -i4.getHeight()))
.objectIDs(OBJs)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.OBJECT))
.build();
arrowPointManager.add(this, objone);
BufferedImage i5 = itemManager.getImage(ItemID.BONES);
ArrowPoint four = ArrowPoint.builder()
.worldPoint(new WorldPoint(1517, 3553, 0))
.minimapImage(i5)
.worldImage(i5)
.minimapImagePointToTarget(false)
.types(EnumSet.of(ArrowType.MINIMAP, ArrowType.WORLD_POINT))
.build();
//arrowPointManager.add(this, four);
}
}

View File

@@ -50,11 +50,13 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Quest Helper",
type = PluginType.UTILITY,
description = "Helps you with your quests"
)
@Slf4j

View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 2018, Shaun Dreclin <https://github.com/ShaunDreclin>
* 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.tarnslair;
import com.google.common.collect.Sets;
import java.util.Set;
import static net.runelite.api.NullObjectID.NULL_20575;
import static net.runelite.api.ObjectID.*;
class Obstacles
{
static final Set<Integer> STAIRCASE_IDS = Sets.newHashSet(
PASSAGEWAY_15770, /*Wall staircase*/
PASSAGEWAY_15771, /*Wall staircase*/
PASSAGEWAY_15772, /*Wall staircase*/
PASSAGEWAY_15773, /*Wall staircase*/
PASSAGEWAY_15774, /*Wall staircase*/
PASSAGEWAY_16129, /*Wall staircase*/
PASSAGEWAY_16130, /*Wall staircase*/
PASSAGEWAY_16131, /*Wall staircase*/
PASSAGEWAY_16132, /*Wall staircase*/
PASSAGEWAY_16133, /*Wall staircase*/
PASSAGEWAY_16134, /*Wall staircase*/
PASSAGEWAY_18307, /*Wall staircase*/
PASSAGEWAY_18308, /*Wall staircase*/
PASSAGEWAY_18309, /*Wall staircase*/
PASSAGEWAY_18310, /*Wall staircase*/
PASSAGEWAY_18311, /*Wall staircase*/
PASSAGEWAY_20488, /*Wall staircase*/
PASSAGEWAY_20489, /*Wall staircase*/
PASSAGEWAY_20490, /*Wall staircase*/
PASSAGEWAY_20491, /*Wall staircase*/
PASSAGEWAY_20492, /*Wall staircase*/
PASSAGEWAY_20493, /*Wall staircase*/
PASSAGEWAY_20495, /*Wall staircase*/
PASSAGEWAY_20497, /*Wall staircase*/
PASSAGEWAY_20498, /*Wall staircase*/
PASSAGEWAY_20499, /*Wall staircase*/
PASSAGEWAY_20500, /*Wall staircase*/
PASSAGEWAY_20501, /*Wall staircase*/
PASSAGEWAY_20502, /*Wall staircase*/
PASSAGEWAY_20503, /*Wall staircase*/
PASSAGEWAY_20504, /*Wall staircase*/
PASSAGEWAY_20505, /*Wall staircase*/
PASSAGEWAY_20506, /*Wall staircase*/
PASSAGEWAY_20506, /*Wall staircase*/
PASSAGEWAY_20507, /*Wall staircase*/
PASSAGEWAY_20509, /*Wall staircase*/
PASSAGEWAY_20510, /*Wall staircase*/
PASSAGEWAY_20511, /*Wall staircase*/
PASSAGEWAY_20512, /*Wall staircase*/
PASSAGEWAY_20513, /*Wall staircase*/
PASSAGEWAY_20514, /*Wall staircase*/
PASSAGEWAY_20515, /*Wall staircase*/
PASSAGEWAY_20516, /*Wall staircase*/
PASSAGEWAY_20517, /*Wall staircase*/
PASSAGEWAY_20518, /*Wall staircase*/
PASSAGEWAY_20519, /*Wall staircase*/
PASSAGEWAY_20520, /*Wall staircase*/
PASSAGEWAY_20521, /*Wall staircase*/
PASSAGEWAY_20522, /*Wall staircase*/
PASSAGEWAY_20523, /*Wall staircase*/
PASSAGEWAY_20524, /*Wall staircase*/
PASSAGEWAY_20525, /*Wall staircase*/
PASSAGEWAY_20526, /*Wall staircase*/
PASSAGEWAY_20527, /*Wall staircase*/
PASSAGEWAY_20528, /*Wall staircase*/
PASSAGEWAY_20529, /*Wall staircase*/
PASSAGEWAY_20530, /*Wall staircase*/
PASSAGEWAY_20531, /*Wall staircase*/
PASSAGEWAY_20532, /*Wall staircase*/
PASSAGEWAY_20533, /*Wall staircase*/
PASSAGEWAY_20534, /*Wall staircase*/
PASSAGEWAY_20535, /*Wall staircase*/
PASSAGEWAY_20536, /*Wall staircase*/
PASSAGEWAY_20537, /*Wall staircase*/
PASSAGEWAY_20538, /*Wall staircase*/
PASSAGEWAY_20539, /*Wall staircase*/
STAIRS_17098, /*Floor staircase*/
STAIRS_17099, /*Floor staircase*/
STAIRS_18973, /*Floor staircase*/
STAIRS_18974 /*Floor staircase*/
);
static final Set<Integer> WALL_TRAP_IDS = Sets.newHashSet(
WALL_20590, /*Wall spikes*/
WALL_20592, /*Wall spikes*/
WALL_20594, /*Wall spikes*/
WALL_20596, /*Wall spikes*/
WALL_20588, /*Wall spikes*/
WALL_20613, /*Wall pusher*/
WALL_20615, /*Wall pusher*/
WALL_20616, /*Wall pusher*/
WALL_20618, /*Wall pusher*/
HANGING_LOG_20571, /*Hanging log*/
HANGING_LOG_20572, /*Hanging log*/
HANGING_LOG_20573, /*Hanging log*/
HANGING_LOG_20574 /*Hanging log*/
);
static final Set<Integer> FLOOR_TRAP_IDS = Sets.newHashSet(
FLOOR_20583, /*Floor spikes*/
FLOOR_20584, /*Floor spikes*/
NULL_20575, /*Floor spikes (visible)*/
FLOOR_20628, /*Trapdoor*/
FLOOR_20634, /*Floor button*/
FLOOR_20636 /*Floor button*/
);
}

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2018, Shaun Dreclin <https://github.com/ShaunDreclin>
* 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.tarnslair;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.coords.LocalPoint;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@Slf4j
public class TarnsLairOverlay extends Overlay
{
private static final int MAX_DISTANCE = 2350;
private final Client client;
private final TarnsLairPlugin plugin;
@Inject
public TarnsLairOverlay(Client client, TarnsLairPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.isInLair())
{
return null;
}
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
plugin.getStaircases().forEach((obstacle, tile) ->
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
Polygon p = tile.getGameObjects()[0].getConvexHull();
if (p != null)
{
graphics.setColor(Color.GREEN);
graphics.drawPolygon(p);
}
}
});
plugin.getWallTraps().forEach((obstacle, tile) ->
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
Polygon p = tile.getGameObjects()[0].getConvexHull();
if (p != null)
{
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
}
}
});
plugin.getFloorTraps().forEach((obstacle, tile) ->
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
Polygon p = obstacle.getCanvasTilePoly();
if (p != null)
{
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
}
}
});
return null;
}
}

View File

@@ -0,0 +1,171 @@
/*
* Copyright (c) 2018-2019, Shaun Dreclin <https://github.com/ShaunDreclin>
* 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.tarnslair;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Tile;
import net.runelite.api.TileObject;
import net.runelite.api.events.GameObjectChanged;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.GroundObjectChanged;
import net.runelite.api.events.GroundObjectDespawned;
import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Tarn's Lair",
description = "Mark tiles and clickboxes to help traverse the maze",
tags = {"agility", "maze", "minigame", "overlay"}
)
@Slf4j
public class TarnsLairPlugin extends Plugin
{
private static final int TARNS_LAIR_NORTH_REGION = 12616;
private static final int TARNS_LAIR_SOUTH_REGION = 12615;
@Getter(AccessLevel.PACKAGE)
private final HashMap<TileObject, Tile> staircases = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private final HashMap<TileObject, Tile> wallTraps = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private final HashMap<TileObject, Tile> floorTraps = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private boolean inLair;
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private TarnsLairOverlay overlay;
@Override
protected void startUp() throws Exception
{
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
staircases.clear();
wallTraps.clear();
floorTraps.clear();
inLair = false;
}
@Subscribe
public void onGameTick(GameTick event)
{
int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
inLair = (regionID == TARNS_LAIR_NORTH_REGION || regionID == TARNS_LAIR_SOUTH_REGION);
}
@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getGameObject());
}
@Subscribe
public void onGameObjectChanged(GameObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getGameObject());
}
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event)
{
onTileObject(event.getTile(), event.getGameObject(), null);
}
@Subscribe
public void onGroundObjectSpawned(GroundObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getGroundObject());
}
@Subscribe
public void onGroundObjectChanged(GroundObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject());
}
@Subscribe
public void onGroundObjectDespawned(GroundObjectDespawned event)
{
onTileObject(event.getTile(), event.getGroundObject(), null);
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
{
staircases.clear();
wallTraps.clear();
floorTraps.clear();
}
}
private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject)
{
staircases.remove(oldObject);
if (newObject != null && Obstacles.STAIRCASE_IDS.contains(newObject.getId()))
{
staircases.put(newObject, tile);
}
wallTraps.remove(oldObject);
if (newObject != null && Obstacles.WALL_TRAP_IDS.contains(newObject.getId()))
{
wallTraps.put(newObject, tile);
}
floorTraps.remove(oldObject);
if (newObject != null && Obstacles.FLOOR_TRAP_IDS.contains(newObject.getId()))
{
floorTraps.put(newObject, tile);
}
}
}

View File

@@ -292,6 +292,13 @@ public class XpGlobesOverlay extends Overlay
.right(xpHrString)
.build());
}
String timeLeft = xpTrackerService.getTimeTillGoal(mouseOverSkill.getSkill());
xpTooltip.getChildren().add(LineComponent.builder()
.left("Time left:")
.leftColor(Color.ORANGE)
.right(timeLeft)
.build());
}
xpTooltip.render(graphics);

View File

@@ -62,4 +62,9 @@ public interface XpTrackerService
* Get the amount of XP left until goal level
*/
int getEndGoalXp(Skill skill);
/**
* Get the amount of time left until goal level
*/
String getTimeTillGoal(Skill skill);
}

View File

@@ -80,4 +80,10 @@ class XpTrackerServiceImpl implements XpTrackerService
{
return plugin.getSkillSnapshot(skill).getEndGoalXp();
}
@Override
public String getTimeTillGoal(Skill skill)
{
return plugin.getSkillSnapshot(skill).getTimeTillGoal();
}
}

View File

@@ -375,6 +375,9 @@ public interface RSClient extends RSGameEngine, Client
@Import("createSprite")
RSSpritePixels createItemSprite(int itemId, int quantity, int thickness, int borderColor, int stackable, boolean noted);
@Override
void invokeMenuAction(int n2, int n3, int n4, int n5, String string, String string2, int n6, int n7);
@Import("decodeSprite")
void decodeSprite(byte[] data);