Remote projectile target and length tracking

Continuation of 4c293e612cd4b08fc7230a5e6722c8acc74e5a9e
This commit is contained in:
Adam
2018-01-29 08:10:46 -05:00
parent d19c9c1e62
commit f31bc0d794
3 changed files with 1 additions and 98 deletions

View File

@@ -32,10 +32,6 @@ public interface Projectile extends Renderable
Actor getInteracting();
Point getTarget();
int getTargetZ();
int getX1();
int getY1();
@@ -48,12 +44,6 @@ public interface Projectile extends Renderable
int getStartMovementCycle();
int getSpawnCycle();
int getCycleLength();
Duration getLength();
int getEndCycle();
int getRemainingCycles();

View File

@@ -350,7 +350,6 @@ public class DevToolsOverlay extends Overlay
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
}
long projectileLength = projectile.getLength().toMillis();
int projectileId = projectile.getId();
Actor projectileInteracting = projectile.getInteracting();
@@ -365,18 +364,12 @@ public class DevToolsOverlay extends Overlay
infoString += "Targeted (T: " + projectileInteracting.getName() + ")";
}
infoString += " (ID: " + projectileId + ") (L: " + projectileLength + "ms)";
infoString += " (ID: " + projectileId + ")";
if (projectileInteracting != null)
{
OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED);
}
else
{
net.runelite.api.Point targetPoint = projectile.getTarget();
OverlayUtil.renderTilePointOverlay(graphics, client, targetPoint, infoString, Color.RED);
}
}
}

View File

@@ -26,11 +26,8 @@ package net.runelite.mixins;
import java.time.Duration;
import net.runelite.api.Actor;
import net.runelite.api.Point;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNPC;
@@ -43,65 +40,6 @@ public abstract class RSProjectileMixin implements RSProjectile
@Shadow("clientInstance")
private static RSClient client;
@Inject
private int targetX;
@Inject
private int targetY;
@Inject
private int targetZ;
@Inject
Integer spawnCycle;
@Inject
@Override
public Point getTarget()
{
if (targetX == -1 || targetY == -1)
{
return null;
}
return new Point(targetX, targetY);
}
@Inject
@Override
public int getTargetZ()
{
return targetZ;
}
@Inject
@Override
public int getSpawnCycle()
{
return spawnCycle == null ? -1 : spawnCycle;
}
/**
* the cycles returned are for the amount of time moving this works
* better with the projectile movement event as it only gets called
* after the projectile starts moving
*
* @return total time projectile will move for in gamecycles
*/
@Inject
@Override
public int getCycleLength()
{
return getEndCycle() - getSpawnCycle();
}
@Inject
@Override
public Duration getLength()
{
return Duration.ofMillis(getCycleLength() * 20);
}
@Inject
@Override
public int getRemainingCycles()
@@ -140,22 +78,4 @@ public abstract class RSProjectileMixin implements RSProjectile
return players[idx];
}
}
@Copy("moveProjectile")
abstract void moveProjectile(int targetX, int targetY, int targetZ, int gameCycle);
@Replace("moveProjectile")
public void rl$moveProjectile(int targetX, int targetY, int targetZ, int gameCycle)
{
this.targetX = targetX;
this.targetY = targetY;
this.targetZ = targetZ;
if (spawnCycle == null)
{
spawnCycle = client.getGameCycle();
}
moveProjectile(targetX, targetY, targetZ, gameCycle);
}
}