runelite-client: add debug/ground item plugins for labeling objects and tiles, and the apis for them
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
* (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.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
import java.awt.Canvas;
|
import java.awt.Canvas;
|
||||||
@@ -40,7 +39,9 @@ public class Client
|
|||||||
public Player getLocalPlayer()
|
public Player getLocalPlayer()
|
||||||
{
|
{
|
||||||
if (client.getLocalPlayer() == null)
|
if (client.getLocalPlayer() == null)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Player(this, client.getLocalPlayer());
|
return new Player(this, client.getLocalPlayer());
|
||||||
}
|
}
|
||||||
@@ -48,15 +49,15 @@ public class Client
|
|||||||
public NPC[] getNpcs()
|
public NPC[] getNpcs()
|
||||||
{
|
{
|
||||||
return Arrays.stream(client.getCachedNPCs())
|
return Arrays.stream(client.getCachedNPCs())
|
||||||
.map(npc -> npc != null ? new NPC(this, npc) : null)
|
.map(npc -> npc != null ? new NPC(this, npc) : null)
|
||||||
.toArray(size -> new NPC[size]);
|
.toArray(size -> new NPC[size]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player[] getPlayers()
|
public Player[] getPlayers()
|
||||||
{
|
{
|
||||||
return Arrays.stream(client.getCachedPlayers())
|
return Arrays.stream(client.getCachedPlayers())
|
||||||
.map(player -> player != null ? new Player(this, player) : null)
|
.map(player -> player != null ? new Player(this, player) : null)
|
||||||
.toArray(size -> new Player[size]);
|
.toArray(size -> new Player[size]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getBoostedSkillLevels()
|
public int[] getBoostedSkillLevels()
|
||||||
@@ -158,4 +159,19 @@ public class Client
|
|||||||
{
|
{
|
||||||
return client.getPlane();
|
return client.getPlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Region getRegion()
|
||||||
|
{
|
||||||
|
return new Region(this, client.getRegion());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBaseX()
|
||||||
|
{
|
||||||
|
return client.getBaseX();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBaseY()
|
||||||
|
{
|
||||||
|
return client.getBaseY();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorative object, such as objects on walls
|
||||||
|
*
|
||||||
|
* @author Adam
|
||||||
|
*/
|
||||||
|
public class DecorativeObject extends TileObject
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.DecorativeObject decorativeObject;
|
||||||
|
|
||||||
|
public DecorativeObject(Client client, net.runelite.rs.api.DecorativeObject decorativeObject)
|
||||||
|
{
|
||||||
|
super(client);
|
||||||
|
this.decorativeObject = decorativeObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHash()
|
||||||
|
{
|
||||||
|
return decorativeObject.getHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalX()
|
||||||
|
{
|
||||||
|
return decorativeObject.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalY()
|
||||||
|
{
|
||||||
|
return decorativeObject.getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
58
runelite-api/src/main/java/net/runelite/api/GameObject.java
Normal file
58
runelite-api/src/main/java/net/runelite/api/GameObject.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adam
|
||||||
|
*/
|
||||||
|
public class GameObject extends TileObject
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.GameObject gameObject;
|
||||||
|
|
||||||
|
public GameObject(Client client, net.runelite.rs.api.GameObject gameObject)
|
||||||
|
{
|
||||||
|
super(client);
|
||||||
|
this.gameObject = gameObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHash()
|
||||||
|
{
|
||||||
|
return gameObject.getHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalX()
|
||||||
|
{
|
||||||
|
return gameObject.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalY()
|
||||||
|
{
|
||||||
|
return gameObject.getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public class GroundObject extends TileObject
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.GroundObject groundObject;
|
||||||
|
|
||||||
|
public GroundObject(Client client, net.runelite.rs.api.GroundObject groundObject)
|
||||||
|
{
|
||||||
|
super(client);
|
||||||
|
this.groundObject = groundObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHash()
|
||||||
|
{
|
||||||
|
return groundObject.getHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalX()
|
||||||
|
{
|
||||||
|
return groundObject.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalY()
|
||||||
|
{
|
||||||
|
return groundObject.getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
46
runelite-api/src/main/java/net/runelite/api/Item.java
Normal file
46
runelite-api/src/main/java/net/runelite/api/Item.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public class Item extends Renderable
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.Item item;
|
||||||
|
|
||||||
|
public Item(net.runelite.rs.api.Item item)
|
||||||
|
{
|
||||||
|
super(item);
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return item.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQuantity()
|
||||||
|
{
|
||||||
|
return item.getQuantity();
|
||||||
|
}
|
||||||
|
}
|
||||||
69
runelite-api/src/main/java/net/runelite/api/ItemLayer.java
Normal file
69
runelite-api/src/main/java/net/runelite/api/ItemLayer.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public class ItemLayer extends TileObject
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.ItemLayer itemLayer;
|
||||||
|
|
||||||
|
public ItemLayer(Client client, net.runelite.rs.api.ItemLayer itemLayer)
|
||||||
|
{
|
||||||
|
super(client);
|
||||||
|
this.itemLayer = itemLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHash()
|
||||||
|
{
|
||||||
|
return itemLayer.getHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalX()
|
||||||
|
{
|
||||||
|
return itemLayer.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalY()
|
||||||
|
{
|
||||||
|
return itemLayer.getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Renderable getBottom()
|
||||||
|
{
|
||||||
|
return Renderable.of(itemLayer.getBottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Renderable getMiddle()
|
||||||
|
{
|
||||||
|
return Renderable.of(itemLayer.getMiddle());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Renderable getTop()
|
||||||
|
{
|
||||||
|
return Renderable.of(itemLayer.getTop());
|
||||||
|
}
|
||||||
|
}
|
||||||
71
runelite-api/src/main/java/net/runelite/api/Node.java
Normal file
71
runelite-api/src/main/java/net/runelite/api/Node.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public class Node
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.Node node;
|
||||||
|
|
||||||
|
public Node(net.runelite.rs.api.Node node)
|
||||||
|
{
|
||||||
|
this.node = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "Node{" + "node=" + node + '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Node getNext()
|
||||||
|
{
|
||||||
|
return of(node.getNext());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Node getPrev()
|
||||||
|
{
|
||||||
|
return of(node.getPrevious());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Node of(net.runelite.rs.api.Node node)
|
||||||
|
{
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node instanceof net.runelite.rs.api.Item)
|
||||||
|
{
|
||||||
|
return new Item((net.runelite.rs.api.Item) node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node instanceof net.runelite.rs.api.Renderable)
|
||||||
|
{
|
||||||
|
return new Renderable((net.runelite.rs.api.Renderable) node);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Node(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,10 @@ package net.runelite.api;
|
|||||||
public class Perspective
|
public class Perspective
|
||||||
{
|
{
|
||||||
private static final double UNIT = Math.PI / 1024d; // How much of the circle each unit of SINE/COSINE is
|
private static final double UNIT = Math.PI / 1024d; // How much of the circle each unit of SINE/COSINE is
|
||||||
|
|
||||||
|
private static final int LOCAL_COORD_BITS = 7;
|
||||||
|
private static final int LOCAL_TILE_SIZE = 1 << LOCAL_COORD_BITS; // 128 - size of a tile in local coordinates
|
||||||
|
|
||||||
public static final int[] SINE = new int[2048]; // sine angles for each of the 2048 units, * 65536 and stored as an int
|
public static final int[] SINE = new int[2048]; // sine angles for each of the 2048 units, * 65536 and stored as an int
|
||||||
public static final int[] COSINE = new int[2048]; // cosine
|
public static final int[] COSINE = new int[2048]; // cosine
|
||||||
|
|
||||||
@@ -119,4 +123,22 @@ public class Perspective
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Point worldToLocal(Client client, Point point)
|
||||||
|
{
|
||||||
|
int baseX = client.getBaseX();
|
||||||
|
int baseY = client.getBaseY();
|
||||||
|
|
||||||
|
int x = (point.getX() - baseX) << LOCAL_COORD_BITS;
|
||||||
|
int y = (point.getY() - baseY) << LOCAL_COORD_BITS;
|
||||||
|
|
||||||
|
return new Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Point localToWorld(Client client, Point point)
|
||||||
|
{
|
||||||
|
int x = (point.getX() >>> LOCAL_COORD_BITS) + client.getBaseX();
|
||||||
|
int y = (point.getY() >>> LOCAL_COORD_BITS) + client.getBaseY();
|
||||||
|
return new Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,19 @@ public class Point
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the distance from this point to another point
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int distanceTo(Point other)
|
||||||
|
{
|
||||||
|
int dx = x - other.x;
|
||||||
|
int dy = y - other.y;
|
||||||
|
return (int) Math.sqrt(dx * dx + dy * dy);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
|
|||||||
51
runelite-api/src/main/java/net/runelite/api/Region.java
Normal file
51
runelite-api/src/main/java/net/runelite/api/Region.java
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Region
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final net.runelite.rs.api.Region region;
|
||||||
|
|
||||||
|
public Region(Client client, net.runelite.rs.api.Region region)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.region = region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tile[][][] getTiles()
|
||||||
|
{
|
||||||
|
return Arrays.stream(region.getTiles())
|
||||||
|
.map(tile1 -> Arrays.stream(tile1)
|
||||||
|
.map(tile2 -> Arrays.stream(tile2)
|
||||||
|
.map(tile3 -> new Tile(client, tile3))
|
||||||
|
.toArray(i -> new Tile[i])
|
||||||
|
)
|
||||||
|
.toArray(i -> new Tile[i][])
|
||||||
|
).toArray(i -> new Tile[i][][]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,15 +22,20 @@
|
|||||||
* (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.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
public class Renderable
|
public class Renderable extends Node
|
||||||
{
|
{
|
||||||
private net.runelite.rs.api.Renderable renderable;
|
private final net.runelite.rs.api.Renderable renderable;
|
||||||
|
|
||||||
public Renderable(net.runelite.rs.api.Renderable renderable)
|
public Renderable(net.runelite.rs.api.Renderable renderable)
|
||||||
{
|
{
|
||||||
|
super(renderable);
|
||||||
this.renderable = renderable;
|
this.renderable = renderable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Renderable of(net.runelite.rs.api.Renderable renderable)
|
||||||
|
{
|
||||||
|
return (Renderable) Node.of(renderable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
106
runelite-api/src/main/java/net/runelite/api/Tile.java
Normal file
106
runelite-api/src/main/java/net/runelite/api/Tile.java
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Tile
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final net.runelite.rs.api.Tile tile;
|
||||||
|
|
||||||
|
public Tile(Client client, net.runelite.rs.api.Tile tile)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.tile = tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the decorative object for this tile.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DecorativeObject getDecorativeObject()
|
||||||
|
{
|
||||||
|
net.runelite.rs.api.DecorativeObject decorativeObject = tile.getDecorativeObject();
|
||||||
|
|
||||||
|
if (decorativeObject == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DecorativeObject(client, decorativeObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameObject[] getGameObjects()
|
||||||
|
{
|
||||||
|
net.runelite.rs.api.GameObject[] objects = tile.getObjects();
|
||||||
|
|
||||||
|
if (objects == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Arrays.stream(tile.getObjects())
|
||||||
|
.map(go -> go != null ? new GameObject(client, go) : null)
|
||||||
|
.toArray(i -> new GameObject[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemLayer getItemLayer()
|
||||||
|
{
|
||||||
|
net.runelite.rs.api.ItemLayer itemLayer = tile.getItemLayer();
|
||||||
|
|
||||||
|
if (itemLayer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ItemLayer(client, itemLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroundObject getGroundObject()
|
||||||
|
{
|
||||||
|
net.runelite.rs.api.GroundObject groundObject = tile.getGroundObject();
|
||||||
|
|
||||||
|
if (groundObject == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new GroundObject(client, groundObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WallObject getWallObject()
|
||||||
|
{
|
||||||
|
net.runelite.rs.api.WallObject wallObject = tile.getWallObject();
|
||||||
|
|
||||||
|
if (wallObject == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WallObject(client, wallObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
64
runelite-api/src/main/java/net/runelite/api/TileObject.java
Normal file
64
runelite-api/src/main/java/net/runelite/api/TileObject.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public abstract class TileObject
|
||||||
|
{
|
||||||
|
protected final Client client;
|
||||||
|
|
||||||
|
public TileObject(Client client)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract int getHash();
|
||||||
|
|
||||||
|
protected abstract int getLocalX();
|
||||||
|
|
||||||
|
protected abstract int getLocalY();
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
int hash = getHash();
|
||||||
|
return hash >> 14 & 32767;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getWorldLocation()
|
||||||
|
{
|
||||||
|
Point localLocation = getLocalLocation();
|
||||||
|
return Perspective.localToWorld(client, localLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getLocalLocation()
|
||||||
|
{
|
||||||
|
return new Point(getLocalX(), getLocalY());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getCanvasLocation()
|
||||||
|
{
|
||||||
|
Point locaLocation = getLocalLocation();
|
||||||
|
return Perspective.worldToCanvas(client, locaLocation.getX(), locaLocation.getY(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
59
runelite-api/src/main/java/net/runelite/api/WallObject.java
Normal file
59
runelite-api/src/main/java/net/runelite/api/WallObject.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wall object, which is a boundary you can't walk through.
|
||||||
|
*
|
||||||
|
* @author Adam
|
||||||
|
*/
|
||||||
|
public class WallObject extends TileObject
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.WallObject wallObject;
|
||||||
|
|
||||||
|
public WallObject(Client client, net.runelite.rs.api.WallObject wallObject)
|
||||||
|
{
|
||||||
|
super(client);
|
||||||
|
this.wallObject = wallObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHash()
|
||||||
|
{
|
||||||
|
return wallObject.getHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalX()
|
||||||
|
{
|
||||||
|
return wallObject.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLocalY()
|
||||||
|
{
|
||||||
|
return wallObject.getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
* (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;
|
package net.runelite.client.plugins;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -31,12 +30,18 @@ import java.util.List;
|
|||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.plugins.boosts.Boosts;
|
import net.runelite.client.plugins.boosts.Boosts;
|
||||||
import net.runelite.client.plugins.bosstimer.BossTimers;
|
import net.runelite.client.plugins.bosstimer.BossTimers;
|
||||||
|
import net.runelite.client.plugins.debug.Debug;
|
||||||
import net.runelite.client.plugins.fpsinfo.FPS;
|
import net.runelite.client.plugins.fpsinfo.FPS;
|
||||||
|
import net.runelite.client.plugins.gronditems.GroundItems;
|
||||||
import net.runelite.client.plugins.hiscore.Hiscore;
|
import net.runelite.client.plugins.hiscore.Hiscore;
|
||||||
import net.runelite.client.plugins.opponentinfo.OpponentInfo;
|
import net.runelite.client.plugins.opponentinfo.OpponentInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class PluginManager
|
public class PluginManager
|
||||||
{
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(PluginManager.class);
|
||||||
|
|
||||||
private final RuneLite runelite;
|
private final RuneLite runelite;
|
||||||
private final List<Plugin> plugins = new ArrayList<>();
|
private final List<Plugin> plugins = new ArrayList<>();
|
||||||
|
|
||||||
@@ -52,6 +57,14 @@ public class PluginManager
|
|||||||
load(new FPS());
|
load(new FPS());
|
||||||
load(new Hiscore());
|
load(new Hiscore());
|
||||||
load(new BossTimers());
|
load(new BossTimers());
|
||||||
|
|
||||||
|
if (RuneLite.getOptions().has("developer-mode"))
|
||||||
|
{
|
||||||
|
logger.info("Loading developer plugins");
|
||||||
|
|
||||||
|
load(new Debug());
|
||||||
|
load(new GroundItems());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void load(Plugin plugin)
|
private void load(Plugin plugin)
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.debug;
|
||||||
|
|
||||||
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
|
||||||
|
public class Debug extends Plugin
|
||||||
|
{
|
||||||
|
private final DebugOverlay debugOverlay = new DebugOverlay();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Overlay getOverlay()
|
||||||
|
{
|
||||||
|
return debugOverlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.debug;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.DecorativeObject;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.GroundObject;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.Region;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
|
import net.runelite.api.TileObject;
|
||||||
|
import net.runelite.api.WallObject;
|
||||||
|
import net.runelite.client.RuneLite;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
|
public class DebugOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Client client = RuneLite.getClient();
|
||||||
|
|
||||||
|
private static final int REGION_SIZE = 104;
|
||||||
|
|
||||||
|
public DebugOverlay()
|
||||||
|
{
|
||||||
|
super(OverlayPosition.DYNAMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (client.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region region = client.getRegion();
|
||||||
|
Tile[][][] tiles = region.getTiles();
|
||||||
|
|
||||||
|
int z = client.getPlane();
|
||||||
|
|
||||||
|
for (int x = 0; x < REGION_SIZE; ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < REGION_SIZE; ++y)
|
||||||
|
{
|
||||||
|
Tile tile = tiles[z][x][y];
|
||||||
|
|
||||||
|
if (tile == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
render(graphics, tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void render(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
renderDecorativeObject(graphics, tile);
|
||||||
|
renderWallObject(graphics, tile);
|
||||||
|
renderGroundObject(graphics, tile);
|
||||||
|
renderGameObjects(graphics, tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderDecorativeObject(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
DecorativeObject decorativeObject = tile.getDecorativeObject();
|
||||||
|
if (decorativeObject == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = decorativeObject.getId();
|
||||||
|
renderTileObject(graphics, decorativeObject, Color.RED, "D" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderWallObject(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
WallObject wallObject = tile.getWallObject();
|
||||||
|
if (wallObject == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = wallObject.getId();
|
||||||
|
renderTileObject(graphics, wallObject, Color.GREEN, "W" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGroundObject(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
GroundObject groundObject = tile.getGroundObject();
|
||||||
|
if (groundObject == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = groundObject.getId();
|
||||||
|
renderTileObject(graphics, groundObject, Color.BLUE, "G" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGameObjects(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
GameObject[] gameObjects = tile.getGameObjects();
|
||||||
|
if (gameObjects == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (GameObject gameObject : gameObjects)
|
||||||
|
{
|
||||||
|
if (gameObject == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTileObject(graphics, gameObject, Color.YELLOW, "GA" + gameObject.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTileObject(Graphics2D graphics, TileObject tileObject, Color color, String text)
|
||||||
|
{
|
||||||
|
Point canvasLocation = tileObject.getCanvasLocation();
|
||||||
|
|
||||||
|
if (canvasLocation == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
graphics.setColor(color);
|
||||||
|
graphics.drawString(text, canvasLocation.getX(), canvasLocation.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.gronditems;
|
||||||
|
|
||||||
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
|
||||||
|
public class GroundItems extends Plugin
|
||||||
|
{
|
||||||
|
private final GroundItemsOverlay groundItemsOverlay = new GroundItemsOverlay();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Overlay getOverlay()
|
||||||
|
{
|
||||||
|
return groundItemsOverlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.gronditems;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemLayer;
|
||||||
|
import net.runelite.api.Node;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.Region;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
|
import net.runelite.client.RuneLite;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
|
public class GroundItemsOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Client client = RuneLite.getClient();
|
||||||
|
|
||||||
|
private static final int REGION_SIZE = 104;
|
||||||
|
|
||||||
|
public GroundItemsOverlay()
|
||||||
|
{
|
||||||
|
super(OverlayPosition.DYNAMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (client.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region region = client.getRegion();
|
||||||
|
Tile[][][] tiles = region.getTiles();
|
||||||
|
|
||||||
|
int z = client.getPlane();
|
||||||
|
|
||||||
|
for (int x = 0; x < REGION_SIZE; ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < REGION_SIZE; ++y)
|
||||||
|
{
|
||||||
|
Tile tile = tiles[z][x][y];
|
||||||
|
|
||||||
|
if (tile == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
render(graphics, tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void render(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
ItemLayer itemLayer = tile.getItemLayer();
|
||||||
|
|
||||||
|
if (itemLayer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Point canvasLocation = itemLayer.getCanvasLocation();
|
||||||
|
if (canvasLocation == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node current = itemLayer.getBottom();
|
||||||
|
|
||||||
|
while (current instanceof Item)
|
||||||
|
{
|
||||||
|
Item item = (Item) current;
|
||||||
|
render(graphics, canvasLocation, item);
|
||||||
|
current = current.getNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void render(Graphics2D graphics, Point canvasLocation, Item item)
|
||||||
|
{
|
||||||
|
graphics.setColor(Color.ORANGE);
|
||||||
|
graphics.drawString("I" + item.getId(), canvasLocation.getX(), canvasLocation.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.ui.overlay;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DynamicRenderer implements Renderer
|
||||||
|
{
|
||||||
|
private final List<Overlay> overlays = new ArrayList<>();
|
||||||
|
|
||||||
|
public void add(Overlay overlay)
|
||||||
|
{
|
||||||
|
overlays.add(overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(BufferedImage clientBuffer)
|
||||||
|
{
|
||||||
|
for (Overlay overlay : overlays)
|
||||||
|
{
|
||||||
|
Graphics2D graphics = clientBuffer.createGraphics();
|
||||||
|
overlay.render(graphics);
|
||||||
|
graphics.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,6 +33,11 @@ public abstract class Overlay
|
|||||||
private OverlayPosition position; // where to draw it
|
private OverlayPosition position; // where to draw it
|
||||||
private OverlayPriority priority; // if multiple overlays exist in the same position, who wins
|
private OverlayPriority priority; // if multiple overlays exist in the same position, who wins
|
||||||
|
|
||||||
|
public Overlay(OverlayPosition position)
|
||||||
|
{
|
||||||
|
this(position, OverlayPriority.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
public Overlay(OverlayPosition position, OverlayPriority priority)
|
public Overlay(OverlayPosition position, OverlayPriority priority)
|
||||||
{
|
{
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|||||||
@@ -22,11 +22,20 @@
|
|||||||
* (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.ui.overlay;
|
package net.runelite.client.ui.overlay;
|
||||||
|
|
||||||
public enum OverlayPosition
|
public enum OverlayPosition
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Place overlay in the top left most area possible
|
||||||
|
*/
|
||||||
TOP_LEFT,
|
TOP_LEFT,
|
||||||
TOP_RIGHT;
|
/**
|
||||||
|
* Place overlay in the top right most area possible
|
||||||
|
*/
|
||||||
|
TOP_RIGHT,
|
||||||
|
/**
|
||||||
|
* Overlay places itself where it wants
|
||||||
|
*/
|
||||||
|
DYNAMIC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package net.runelite.client.ui.overlay;
|
|||||||
|
|
||||||
public enum OverlayPriority
|
public enum OverlayPriority
|
||||||
{
|
{
|
||||||
|
NONE,
|
||||||
LOW,
|
LOW,
|
||||||
MED,
|
MED,
|
||||||
HIGH;
|
HIGH;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class OverlayRenderer
|
|||||||
{
|
{
|
||||||
TopDownRendererLeft tdl = new TopDownRendererLeft();
|
TopDownRendererLeft tdl = new TopDownRendererLeft();
|
||||||
TopDownRendererRight tdr = new TopDownRendererRight();
|
TopDownRendererRight tdr = new TopDownRendererRight();
|
||||||
|
DynamicRenderer dr = new DynamicRenderer();
|
||||||
|
|
||||||
for (Plugin plugin : RuneLite.getRunelite().getPluginManager().getPlugins())
|
for (Plugin plugin : RuneLite.getRunelite().getPluginManager().getPlugins())
|
||||||
{
|
{
|
||||||
@@ -54,10 +55,14 @@ public class OverlayRenderer
|
|||||||
case TOP_LEFT:
|
case TOP_LEFT:
|
||||||
tdl.add(overlay);
|
tdl.add(overlay);
|
||||||
break;
|
break;
|
||||||
|
case DYNAMIC:
|
||||||
|
dr.add(overlay);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tdl.render(clientBuffer);
|
tdl.render(clientBuffer);
|
||||||
tdr.render(clientBuffer);
|
tdr.render(clientBuffer);
|
||||||
|
dr.render(clientBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.ui.overlay;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
public interface Renderer
|
||||||
|
{
|
||||||
|
void render(BufferedImage clientBuffer);
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TopDownRendererLeft
|
public class TopDownRendererLeft implements Renderer
|
||||||
{
|
{
|
||||||
private static final int BORDER_TOP = 25;
|
private static final int BORDER_TOP = 25;
|
||||||
private static final int BORDER_LEFT = 10;
|
private static final int BORDER_LEFT = 10;
|
||||||
@@ -44,6 +44,7 @@ public class TopDownRendererLeft
|
|||||||
overlays.add(overlay);
|
overlays.add(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void render(BufferedImage clientBuffer)
|
public void render(BufferedImage clientBuffer)
|
||||||
{
|
{
|
||||||
overlays.sort((o1, o2) -> o2.getPriority().compareTo(o1.getPriority()));
|
overlays.sort((o1, o2) -> o2.getPriority().compareTo(o1.getPriority()));
|
||||||
|
|||||||
@@ -25,15 +25,15 @@
|
|||||||
|
|
||||||
package net.runelite.client.ui.overlay;
|
package net.runelite.client.ui.overlay;
|
||||||
|
|
||||||
import net.runelite.api.Client;
|
import java.awt.Dimension;
|
||||||
import net.runelite.client.RuneLite;
|
import java.awt.Graphics2D;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.client.RuneLite;
|
||||||
|
|
||||||
public class TopDownRendererRight
|
public class TopDownRendererRight implements Renderer
|
||||||
{
|
{
|
||||||
private static final int BORDER_TOP = 0;
|
private static final int BORDER_TOP = 0;
|
||||||
private static final int BORDER_RIGHT = 0;
|
private static final int BORDER_RIGHT = 0;
|
||||||
@@ -46,6 +46,7 @@ public class TopDownRendererRight
|
|||||||
overlays.add(overlay);
|
overlays.add(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void render(BufferedImage clientBuffer)
|
public void render(BufferedImage clientBuffer)
|
||||||
{
|
{
|
||||||
Client client = RuneLite.getClient();
|
Client client = RuneLite.getClient();
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.rs.api;
|
||||||
|
|
||||||
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
|
public interface DecorativeObject
|
||||||
|
{
|
||||||
|
@Import("hash")
|
||||||
|
int getHash();
|
||||||
|
|
||||||
|
@Import("x")
|
||||||
|
int getX();
|
||||||
|
|
||||||
|
@Import("y")
|
||||||
|
int getY();
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.rs.api;
|
||||||
|
|
||||||
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
|
public interface GroundObject
|
||||||
|
{
|
||||||
|
@Import("hash")
|
||||||
|
int getHash();
|
||||||
|
|
||||||
|
@Import("x")
|
||||||
|
int getX();
|
||||||
|
|
||||||
|
@Import("y")
|
||||||
|
int getY();
|
||||||
|
}
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
* (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.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
@@ -35,6 +34,15 @@ public interface Tile
|
|||||||
@Import("itemLayer")
|
@Import("itemLayer")
|
||||||
ItemLayer getItemLayer();
|
ItemLayer getItemLayer();
|
||||||
|
|
||||||
|
@Import("decorativeObject")
|
||||||
|
DecorativeObject getDecorativeObject();
|
||||||
|
|
||||||
|
@Import("groundObject")
|
||||||
|
GroundObject getGroundObject();
|
||||||
|
|
||||||
|
@Import("wallObject")
|
||||||
|
WallObject getWallObject();
|
||||||
|
|
||||||
@Import("x")
|
@Import("x")
|
||||||
int getX();
|
int getX();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.rs.api;
|
||||||
|
|
||||||
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
|
public interface WallObject
|
||||||
|
{
|
||||||
|
@Import("hash")
|
||||||
|
int getHash();
|
||||||
|
|
||||||
|
@Import("x")
|
||||||
|
int getX();
|
||||||
|
|
||||||
|
@Import("y")
|
||||||
|
int getY();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user