api: remove projectile getInteracting

This is unused currently and is being abused by some hacked clients.
This commit is contained in:
Adam
2019-02-01 20:52:24 -05:00
parent 29fcc2747f
commit 1bb29d4cd0
4 changed files with 7 additions and 72 deletions

View File

@@ -37,13 +37,6 @@ public interface Projectile extends Renderable
*/ */
int getId(); 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();
/** /**
* Gets the original x-axis coordinate that this projectile started from. * Gets the original x-axis coordinate that this projectile started from.
* *

View File

@@ -38,7 +38,6 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.Actor;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Constants; import net.runelite.api.Constants;
import net.runelite.api.DecorativeObject; import net.runelite.api.DecorativeObject;
@@ -386,36 +385,15 @@ class DevToolsOverlay extends Overlay
for (Projectile projectile : projectiles) for (Projectile projectile : projectiles)
{ {
int originX = projectile.getX1();
int originY = projectile.getY1();
LocalPoint tilePoint = new LocalPoint(originX, originY);
Polygon poly = Perspective.getCanvasTilePoly(client, tilePoint);
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
}
int projectileId = projectile.getId(); int projectileId = projectile.getId();
Actor projectileInteracting = projectile.getInteracting(); String text = "(ID: " + projectileId + ")";
int x = (int) projectile.getX();
String infoString = ""; int y = (int) projectile.getY();
LocalPoint projectilePoint = new LocalPoint(x, y);
if (projectileInteracting == null) Point textLocation = Perspective.getCanvasTextLocation(client, graphics, projectilePoint, text, 0);
if (textLocation != null)
{ {
infoString += "AoE"; OverlayUtil.renderTextLocation(graphics, textLocation, text, Color.RED);
}
else
{
infoString += "Targeted (T: " + projectileInteracting.getName() + ")";
}
infoString += " (ID: " + projectileId + ")";
if (projectileInteracting != null)
{
OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED);
} }
} }
} }

View File

@@ -24,7 +24,6 @@
*/ */
package net.runelite.mixins; package net.runelite.mixins;
import net.runelite.api.Actor;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.ProjectileMoved; import net.runelite.api.events.ProjectileMoved;
import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Inject;
@@ -32,8 +31,6 @@ import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow; import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSProjectile; import net.runelite.rs.api.RSProjectile;
@Mixin(RSProjectile.class) @Mixin(RSProjectile.class)
@@ -51,36 +48,6 @@ public abstract class RSProjectileMixin implements RSProjectile
return getEndCycle() - currentGameCycle; return getEndCycle() - currentGameCycle;
} }
@Inject
@Override
public Actor getInteracting()
{
int interactingIndex = getRsInteracting();
if (interactingIndex == 0)
{
return null;
}
if (interactingIndex > 0)
{
int idx = interactingIndex - 1;
RSNPC[] npcs = client.getCachedNPCs();
return npcs[idx];
}
else
{
int idx = -interactingIndex - 1;
if (idx == client.getLocalInteractingIndex())
{
return client.getLocalPlayer();
}
RSPlayer[] players = client.getCachedPlayers();
return players[idx];
}
}
/** /**
* Called when a projectile is set to move towards a point. For * Called when a projectile is set to move towards a point. For
* projectiles that target the ground, like AoE projectiles from * projectiles that target the ground, like AoE projectiles from

View File

@@ -33,9 +33,6 @@ public interface RSProjectile extends RSRenderable, Projectile
@Override @Override
int getId(); int getId();
@Import("interacting")
int getRsInteracting();
@Import("height") @Import("height")
@Override @Override
int getHeight(); int getHeight();