From 0d76c441d30dd506110292bb472493a0d41b8cc0 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 11:21:57 -0500 Subject: [PATCH 1/7] api: remove tileitem spawn time This was never used and has limited use --- runelite-api/src/main/java/net/runelite/api/TileItem.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/TileItem.java b/runelite-api/src/main/java/net/runelite/api/TileItem.java index 87d820241c..8c1b08541e 100644 --- a/runelite-api/src/main/java/net/runelite/api/TileItem.java +++ b/runelite-api/src/main/java/net/runelite/api/TileItem.java @@ -36,10 +36,4 @@ public interface TileItem extends Renderable int getId(); int getQuantity(); - - /** - * Time in game ticks when the item spawned (relative to us) - * @return - */ - int getSpawnTime(); } From dbf1b3b011a03141ebc1fc3c53054d4d5ce1afe5 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 19:40:03 -0500 Subject: [PATCH 2/7] api: combine projectileid and graphicid --- runelite-api/pom.xml | 1 - .../main/java/net/runelite/api/GraphicID.java | 12 ++++-- .../java/net/runelite/api/Projectile.java | 2 +- .../java/net/runelite/api/ProjectileID.java | 38 ------------------- .../client/plugins/cannon/CannonPlugin.java | 4 +- .../client/plugins/zalcano/ZalcanoPlugin.java | 2 +- 6 files changed, 12 insertions(+), 47 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/ProjectileID.java diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 9f0d692fe8..3a6481dfca 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -107,7 +107,6 @@ net/runelite/api/ObjectID.class net/runelite/api/Opcodes.class net/runelite/api/ParamID.class - net/runelite/api/ProjectileID.class net/runelite/api/ScriptID.class net/runelite/api/SettingID.class net/runelite/api/SoundEffectID.class diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicID.java b/runelite-api/src/main/java/net/runelite/api/GraphicID.java index f6c6138da6..d172a7af77 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicID.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicID.java @@ -27,9 +27,11 @@ package net.runelite.api; public final class GraphicID { public static final int WINE_MAKE = 47; + public static final int CANNONBALL = 53; public static final int SPLASH = 85; - public static final int TELEPORT = 111; public static final int GREY_BUBBLE_TELEPORT = 86; + public static final int TELEPORT = 111; + public static final int TELEKINETIC_SPELL = 143; public static final int ENTANGLE = 179; public static final int SNARE = 180; public static final int BIND = 181; @@ -39,14 +41,16 @@ public final class GraphicID public static final int ICE_BARRAGE = 369; public static final int VENGEANCE_OTHER = 725; public static final int VENGEANCE = 726; + public static final int NPC_CONTACT = 728; + public static final int POT_SHARE = 733; + public static final int BAKE_PIE = 746; public static final int BOOK_HOME_TELEPORT_1 = 800; public static final int BOOK_HOME_TELEPORT_2 = 802; public static final int BOOK_HOME_TELEPORT_3 = 803; public static final int BOOK_HOME_TELEPORT_4 = 804; public static final int STAFF_OF_THE_DEAD = 1228; public static final int FLYING_FISH = 1387; - public static final int NPC_CONTACT = 728; - public static final int POT_SHARE = 733; - public static final int BAKE_PIE = 746; + public static final int GRANITE_CANNONBALL = 1443; public static final int GRAPHICS_OBJECT_ROCKFALL = 1727; + public static final int ZALCANO_PROJECTILE_FIREBALL = 1728; } diff --git a/runelite-api/src/main/java/net/runelite/api/Projectile.java b/runelite-api/src/main/java/net/runelite/api/Projectile.java index 2f371611d3..a4b98cecfd 100644 --- a/runelite-api/src/main/java/net/runelite/api/Projectile.java +++ b/runelite-api/src/main/java/net/runelite/api/Projectile.java @@ -33,7 +33,7 @@ public interface Projectile extends Renderable * Gets the ID of the projectile. * * @return the projectile ID - * @see ProjectileID + * @see GraphicID */ int getId(); diff --git a/runelite-api/src/main/java/net/runelite/api/ProjectileID.java b/runelite-api/src/main/java/net/runelite/api/ProjectileID.java deleted file mode 100644 index 4030f92e56..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/ProjectileID.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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; - -/** - * Utility class used for mapping projectile IDs. - *

- * Note: This class is not complete and may be missing mapped IDs. - */ -public final class ProjectileID -{ - public static final int CANNONBALL = 53; - public static final int GRANITE_CANNONBALL = 1443; - public static final int TELEKINETIC_SPELL = 143; - public static final int ZALCANO_PROJECTILE_FIREBALL = 1728; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java index bb825bb037..cc5d47324d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java @@ -37,6 +37,8 @@ import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; +import static net.runelite.api.GraphicID.CANNONBALL; +import static net.runelite.api.GraphicID.GRANITE_CANNONBALL; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; @@ -46,8 +48,6 @@ import net.runelite.api.ObjectID; import static net.runelite.api.ObjectID.CANNON_BASE; import net.runelite.api.Player; import net.runelite.api.Projectile; -import static net.runelite.api.ProjectileID.CANNONBALL; -import static net.runelite.api.ProjectileID.GRANITE_CANNONBALL; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java index b529c54aef..7ce702347b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java @@ -33,6 +33,7 @@ import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; import static net.runelite.api.GraphicID.GRAPHICS_OBJECT_ROCKFALL; +import static net.runelite.api.GraphicID.ZALCANO_PROJECTILE_FIREBALL; import net.runelite.api.GraphicsObject; import net.runelite.api.Hitsplat; import net.runelite.api.NPC; @@ -40,7 +41,6 @@ import net.runelite.api.NpcID; import static net.runelite.api.NpcID.ZALCANO; import net.runelite.api.ObjectID; import net.runelite.api.Projectile; -import static net.runelite.api.ProjectileID.ZALCANO_PROJECTILE_FIREBALL; import net.runelite.api.VarPlayer; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; From a37dfd8de550e0eee39ff3c982e744f3ff79e09f Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 16:56:12 -0500 Subject: [PATCH 3/7] api: add actor graphic height accessors --- .../src/main/java/net/runelite/api/Actor.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 3e53351626..850ff1aab7 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -268,6 +268,18 @@ public interface Actor extends Renderable */ void setGraphic(int graphic); + /** + * Get the height of the graphic/spotanim on the actor + * @return + */ + int getGraphicHeight(); + + /** + * Set the height of the graphic/spotanim on the actor + * @param height + */ + void setGraphicHeight(int height); + /** * Get the frame of the currently playing spotanim * From 28a694f69f4a68c40367f81e183c0afc4f255edd Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 17:12:19 -0500 Subject: [PATCH 4/7] api: use deques for projectiles and graphicsobjects --- runelite-api/src/main/java/net/runelite/api/Client.java | 4 ++-- .../runelite/client/plugins/devtools/DevToolsOverlay.java | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index af78dedce3..5bbc86cc59 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1039,14 +1039,14 @@ public interface Client extends GameEngine * * @return all projectiles */ - List getProjectiles(); + Deque getProjectiles(); /** * Gets a list of all graphics objects currently drawn. * * @return all graphics objects */ - List getGraphicsObjects(); + Deque getGraphicsObjects(); /** * Creates a RuneLiteObject, which is a modified {@link GraphicsObject} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java index d7c293d0e9..4217036796 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java @@ -427,9 +427,7 @@ class DevToolsOverlay extends Overlay private void renderProjectiles(Graphics2D graphics) { - List projectiles = client.getProjectiles(); - - for (Projectile projectile : projectiles) + for (Projectile projectile : client.getProjectiles()) { int projectileId = projectile.getId(); String text = "(ID: " + projectileId + ")"; @@ -446,9 +444,7 @@ class DevToolsOverlay extends Overlay private void renderGraphicsObjects(Graphics2D graphics) { - List graphicsObjects = client.getGraphicsObjects(); - - for (GraphicsObject graphicsObject : graphicsObjects) + for (GraphicsObject graphicsObject : client.getGraphicsObjects()) { LocalPoint lp = graphicsObject.getLocation(); Polygon poly = Perspective.getCanvasTilePoly(client, lp); From 07f96a6abbe828db793c7d27e0d154f7606fe9fe Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 17:16:42 -0500 Subject: [PATCH 5/7] api: add projectile target and end cycle setter --- .../java/net/runelite/api/Projectile.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Projectile.java b/runelite-api/src/main/java/net/runelite/api/Projectile.java index a4b98cecfd..4a18937c7a 100644 --- a/runelite-api/src/main/java/net/runelite/api/Projectile.java +++ b/runelite-api/src/main/java/net/runelite/api/Projectile.java @@ -24,6 +24,8 @@ */ package net.runelite.api; +import net.runelite.api.coords.LocalPoint; + /** * Represents a projectile entity. (ie. cannonball, arrow) */ @@ -37,6 +39,21 @@ public interface Projectile extends Renderable */ int getId(); + /** + * Gets the actor that is targeted by this projectile. + * + * @return the target actor, or null if this projectile is an AoE attack + */ + Actor getInteracting(); + + /** + * Get the target point of the projectile. For projectiles with an actor target, + * this is updated each frame to the actor position. + * + * @return + */ + LocalPoint getTarget(); + /** * Gets the original x-axis coordinate that this projectile started from. * @@ -77,7 +94,7 @@ public interface Projectile extends Renderable * * @return the start game cycle */ - int getStartMovementCycle(); + int getStartCycle(); /** * Gets the game cycle that the projectile will reach its target at. @@ -86,6 +103,15 @@ public interface Projectile extends Renderable */ int getEndCycle(); + /** + * Sets the game cycle the projectile will reach its target at. The + * projectile automatically despawns after this time, and setting the + * end cycle to a time in the past is an effective way of removing the + * projectile. + * @param cycle + */ + void setEndCycle(int cycle); + /** * Gets the remaining game cycles until the projectile reaches its * target and despawns. From e31bfa66fec7f5adc2e69e10738297e0d1191a37 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 17:59:14 -0500 Subject: [PATCH 6/7] api: add GraphicsObject finished setter --- .../src/main/java/net/runelite/api/GraphicsObject.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicsObject.java b/runelite-api/src/main/java/net/runelite/api/GraphicsObject.java index da3f944bfc..73ee342777 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicsObject.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicsObject.java @@ -72,4 +72,10 @@ public interface GraphicsObject extends Renderable * @return */ boolean finished(); + + /** + * Set if this spotanim is done animating. If finished, the spotanim will despawn next frame. + * @param finished + */ + void setFinished(boolean finished); } From 82514e0c76ac69500eacd88dcf1404a2f529ed64 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 14 Jan 2022 18:12:23 -0500 Subject: [PATCH 7/7] api: add projectile creation api --- .../main/java/net/runelite/api/Client.java | 20 +++++++++++++++++++ .../src/main/java/net/runelite/api/Deque.java | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 5bbc86cc59..e354a3e5d6 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1034,6 +1034,26 @@ public interface Client extends GameEngine @Nullable LocalPoint getLocalDestinationLocation(); + /** + * Create a projectile. + * @param id projectile/spotanim id + * @param plane plane the projectile is on + * @param startX local x coordinate the projectile starts at + * @param startY local y coordinate the projectile starts at + * @param startZ local z coordinate the projectile starts at - includes tile height + * @param startCycle cycle the project starts + * @param endCycle cycle the projectile ends + * @param slope + * @param startHeight start height of projectile - excludes tile height + * @param endHeight end height of projectile - excludes tile height + * @param target optional actor target + * @param targetX target x - if an actor target is supplied should be the target x + * @param targetY taret y - if an actor target is supplied should be the target y + * @return the new projectile + */ + Projectile createProjectile(int id, int plane, int startX, int startY, int startZ, int startCycle, int endCycle, + int slope, int startHeight, int endHeight, @Nullable Actor target, int targetX, int targetY); + /** * Gets a list of all projectiles currently spawned. * diff --git a/runelite-api/src/main/java/net/runelite/api/Deque.java b/runelite-api/src/main/java/net/runelite/api/Deque.java index 482306b6de..e949f7e7b2 100644 --- a/runelite-api/src/main/java/net/runelite/api/Deque.java +++ b/runelite-api/src/main/java/net/runelite/api/Deque.java @@ -29,6 +29,12 @@ package net.runelite.api; */ public interface Deque extends Iterable { + /** + * Add a new element to the end of the deque + * @param t the element + */ + void addLast(T t); + /** * clear the deque */