@@ -64,7 +64,7 @@ public class AntiDragOverlay extends Overlay
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
final Point mousePosition = new Point(mouseCanvasPosition.getX() - RADIUS, mouseCanvasPosition.getY() - RADIUS);
|
||||
final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, 2 * RADIUS, 2 * RADIUS);
|
||||
g.fillOval(bounds.x, bounds.y, bounds.height, bounds.width);
|
||||
g.fillOval(bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
|
||||
return bounds.getSize();
|
||||
}
|
||||
|
||||
@@ -30,14 +30,14 @@ package net.runelite.client.plugins.aoewarnings;
|
||||
import java.time.Instant;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
public class AoeProjectile
|
||||
class AoeProjectile
|
||||
{
|
||||
private final Instant startTime;
|
||||
private final LocalPoint targetPoint;
|
||||
private final AoeProjectileInfo aoeProjectileInfo;
|
||||
private final int projectileLifetime;
|
||||
|
||||
public AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo, int projectileLifetime)
|
||||
AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo, int projectileLifetime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
this.targetPoint = targetPoint;
|
||||
@@ -45,22 +45,22 @@ public class AoeProjectile
|
||||
this.projectileLifetime = projectileLifetime;
|
||||
}
|
||||
|
||||
public Instant getStartTime()
|
||||
Instant getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public LocalPoint getTargetPoint()
|
||||
LocalPoint getTargetPoint()
|
||||
{
|
||||
return targetPoint;
|
||||
}
|
||||
|
||||
public AoeProjectileInfo getAoeProjectileInfo()
|
||||
AoeProjectileInfo getAoeProjectileInfo()
|
||||
{
|
||||
return aoeProjectileInfo;
|
||||
}
|
||||
|
||||
public int getProjectileLifetime()
|
||||
int getProjectileLifetime()
|
||||
{
|
||||
return projectileLifetime;
|
||||
}
|
||||
|
||||
@@ -33,22 +33,12 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("aoe")
|
||||
public interface AoeWarningConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enabled",
|
||||
name = "AoE Warnings Enabled",
|
||||
description = "Configures whether or not AoE Projectile Warnings plugin is displayed",
|
||||
position = 1
|
||||
)
|
||||
default boolean enabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "outline",
|
||||
name = "Display Outline",
|
||||
description = "Configures whether or not AoE Projectile Warnings have an outline",
|
||||
position = 2
|
||||
position = 1
|
||||
)
|
||||
default boolean isOutlineEnabled()
|
||||
{
|
||||
@@ -59,7 +49,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "fade",
|
||||
name = "Fade Warnings",
|
||||
description = "Configures whether or not AoE Projectile Warnings fade over time",
|
||||
position = 3
|
||||
position = 2
|
||||
)
|
||||
default boolean isFadeEnabled()
|
||||
{
|
||||
@@ -70,7 +60,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "lizardmanaoe",
|
||||
name = "Lizardman Shamans",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed",
|
||||
position = 4
|
||||
position = 3
|
||||
)
|
||||
default boolean isShamansEnabled()
|
||||
{
|
||||
@@ -92,7 +82,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "icedemon",
|
||||
name = "Ice Demon",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed",
|
||||
position = 4
|
||||
position = 5
|
||||
)
|
||||
default boolean isIceDemonEnabled()
|
||||
{
|
||||
@@ -103,7 +93,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "vasa",
|
||||
name = "Vasa",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed",
|
||||
position = 4
|
||||
position = 6
|
||||
)
|
||||
default boolean isVasaEnabled()
|
||||
{
|
||||
@@ -114,7 +104,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "tekton",
|
||||
name = "Tekton",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed",
|
||||
position = 4
|
||||
position = 7
|
||||
)
|
||||
default boolean isTektonEnabled()
|
||||
{
|
||||
@@ -125,7 +115,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "vorkath",
|
||||
name = "Vorkath",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed",
|
||||
position = 4
|
||||
position = 7
|
||||
)
|
||||
default boolean isVorkathEnabled()
|
||||
{
|
||||
@@ -136,7 +126,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "galvek",
|
||||
name = "Galvek",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed",
|
||||
position = 4
|
||||
position = 8
|
||||
)
|
||||
default boolean isGalvekEnabled()
|
||||
{
|
||||
@@ -147,7 +137,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "gargboss",
|
||||
name = "Gargoyle Boss",
|
||||
description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed",
|
||||
position = 4
|
||||
position = 9
|
||||
)
|
||||
default boolean isGargBossEnabled()
|
||||
{
|
||||
@@ -158,7 +148,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "vetion",
|
||||
name = "Vet'ion",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed",
|
||||
position = 4
|
||||
position = 10
|
||||
)
|
||||
default boolean isVetionEnabled()
|
||||
{
|
||||
@@ -169,7 +159,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "chaosfanatic",
|
||||
name = "Chaos Fanatic",
|
||||
description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed",
|
||||
position = 4
|
||||
position = 11
|
||||
)
|
||||
default boolean isChaosFanaticEnabled()
|
||||
{
|
||||
@@ -180,7 +170,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "olm",
|
||||
name = "Olm",
|
||||
description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed",
|
||||
position = 4
|
||||
position = 12
|
||||
)
|
||||
default boolean isOlmEnabled()
|
||||
{
|
||||
@@ -191,7 +181,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "bombDisplay",
|
||||
name = "Olm Bombs",
|
||||
description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.",
|
||||
position = 4
|
||||
position = 13
|
||||
)
|
||||
default boolean bombDisplay()
|
||||
{
|
||||
@@ -202,7 +192,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "corp",
|
||||
name = "Corporeal Beast",
|
||||
description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed",
|
||||
position = 4
|
||||
position = 14
|
||||
)
|
||||
default boolean isCorpEnabled()
|
||||
{
|
||||
@@ -213,7 +203,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "wintertodt",
|
||||
name = "Wintertodt Snow Fall",
|
||||
description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed",
|
||||
position = 4
|
||||
position = 15
|
||||
)
|
||||
default boolean isWintertodtEnabled()
|
||||
{
|
||||
@@ -224,7 +214,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "isXarpusEnabled",
|
||||
name = "Xarpus",
|
||||
description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed",
|
||||
position = 4
|
||||
position = 16
|
||||
)
|
||||
default boolean isXarpusEnabled()
|
||||
{
|
||||
@@ -235,7 +225,7 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "lightning",
|
||||
name = "Olm Lightning Trails",
|
||||
description = "Show Lightning Trails",
|
||||
position = 4
|
||||
position = 17
|
||||
)
|
||||
default boolean LightningTrail()
|
||||
{
|
||||
@@ -246,27 +236,28 @@ public interface AoeWarningConfig extends Config
|
||||
keyName = "addyDrags",
|
||||
name = "Addy Drags",
|
||||
description = "Show Bad Areas",
|
||||
position = 4
|
||||
position = 18
|
||||
)
|
||||
default boolean addyDrags()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "drake",
|
||||
name = "Drakes Breath",
|
||||
description = "Configures if Drakes Breath tile markers are displayed"
|
||||
)
|
||||
default boolean isDrakeEnabled()
|
||||
@ConfigItem(
|
||||
keyName = "drake", name = "Drakes Breath",
|
||||
description = "Configures if Drakes Breath tile markers are displayed",
|
||||
position = 19
|
||||
)
|
||||
default boolean isDrakeEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "cerbFire",
|
||||
name = "Cerberus Fire",
|
||||
description = "Configures if Cerberus fire tile markers are displayed"
|
||||
description = "Configures if Cerberus fire tile markers are displayed",
|
||||
position = 20
|
||||
)
|
||||
default boolean isCerbFireEnabled()
|
||||
{
|
||||
@@ -276,7 +267,8 @@ public interface AoeWarningConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "delay",
|
||||
name = "Fade delay",
|
||||
description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground"
|
||||
description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground",
|
||||
position = 21
|
||||
)
|
||||
default int delay()
|
||||
{
|
||||
|
||||
@@ -69,10 +69,6 @@ public class AoeWarningOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.enabled())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (WorldPoint point : plugin.getLightningTrail())
|
||||
{
|
||||
drawTile(graphics, point, new Color(0,150,200), 2, 150, 50);
|
||||
|
||||
@@ -52,7 +52,6 @@ import net.runelite.api.events.GameObjectSpawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -74,23 +73,28 @@ public class AoeWarningPlugin extends Plugin
|
||||
@Getter
|
||||
private final Map<WorldPoint, CrystalBomb> bombs = new HashMap<>();
|
||||
private final Map<Projectile, AoeProjectile> projectiles = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
public AoeWarningConfig config;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private AoeWarningOverlay coreOverlay;
|
||||
|
||||
@Inject
|
||||
private BombOverlay bombOverlay;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> LightningTrail = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> AcidTrail = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> CrystalSpike = new ArrayList<>();
|
||||
|
||||
@@ -100,7 +104,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
return configManager.getConfig(AoeWarningConfig.class);
|
||||
}
|
||||
|
||||
public Map<Projectile, AoeProjectile> getProjectiles()
|
||||
Map<Projectile, AoeProjectile> getProjectiles()
|
||||
{
|
||||
return projectiles;
|
||||
}
|
||||
@@ -207,11 +211,8 @@ public class AoeWarningPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Map.Entry<WorldPoint, CrystalBomb>> it = bombs.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
for (Map.Entry<WorldPoint, CrystalBomb> entry : bombs.entrySet())
|
||||
{
|
||||
Map.Entry<WorldPoint, CrystalBomb> entry = it.next();
|
||||
CrystalBomb bomb = entry.getValue();
|
||||
bomb.bombClockUpdate();
|
||||
//bombClockUpdate smooths the shown timer; not using this results in 1.2 --> .6 vs. 1.2 --> 1.1, etc.
|
||||
|
||||
@@ -24,6 +24,18 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -31,20 +43,11 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.plugins.aoewarnings.CrystalBomb;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import javax.inject.Inject;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Color;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.BasicStroke;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
@Slf4j
|
||||
public class BombOverlay extends Overlay
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.time.Instant;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import java.time.Instant;
|
||||
|
||||
@Slf4j
|
||||
public class CrystalBomb
|
||||
class CrystalBomb
|
||||
{
|
||||
@Getter
|
||||
private Instant plantedOn;
|
||||
@@ -49,7 +49,7 @@ public class CrystalBomb
|
||||
@Getter
|
||||
private WorldPoint worldLocation;
|
||||
|
||||
public CrystalBomb(GameObject gameObject, int startTick)
|
||||
CrystalBomb(GameObject gameObject, int startTick)
|
||||
{
|
||||
this.plantedOn = Instant.now();
|
||||
this.objectId = gameObject.getId();
|
||||
@@ -57,7 +57,7 @@ public class CrystalBomb
|
||||
this.tickStarted = startTick;
|
||||
}
|
||||
|
||||
public void bombClockUpdate()
|
||||
void bombClockUpdate()
|
||||
{
|
||||
lastClockUpdate = Instant.now();
|
||||
}
|
||||
|
||||
@@ -38,85 +38,115 @@ public interface BarbarianAssaultConfig extends Config
|
||||
description = "Show time to next call change",
|
||||
position = 0
|
||||
)
|
||||
default boolean showTimer() { return true; }
|
||||
default boolean showTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "waveTimes",
|
||||
name = "Show wave and game duration",
|
||||
description = "Displays wave and game duration",
|
||||
position = 1
|
||||
)
|
||||
default boolean waveTimes() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showEggCountMessage",
|
||||
name = "Show count of eggs collected as collector.",
|
||||
description = "Display egg count as collector after each wave",
|
||||
position = 2
|
||||
)
|
||||
default boolean showEggCount() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showEggCountOverlay",
|
||||
name = "Overlay of eggs counted",
|
||||
description = "Display current egg count as collector",
|
||||
position = 3
|
||||
)
|
||||
default boolean showEggCountOverlay() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showHpCountMessage",
|
||||
name = "Show count of Hp healed as healer.",
|
||||
description = "Display healed count as healer after each wave",
|
||||
position = 4
|
||||
)
|
||||
default boolean showHpCount() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showHpCountOverlay",
|
||||
name = "Overlay of Hp counted",
|
||||
description = "Display current healed count as healer",
|
||||
position = 5
|
||||
position = 1
|
||||
)
|
||||
default boolean showHpCountOverlay() { return false; }
|
||||
default boolean waveTimes()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightCollectorEggs",
|
||||
name = "Highlight collector eggs",
|
||||
description = "Highlight called egg colors",
|
||||
position = 6
|
||||
keyName = "showEggCountMessage",
|
||||
name = "Show count of eggs collected as collector.",
|
||||
description = "Display egg count as collector after each wave",
|
||||
position = 2
|
||||
)
|
||||
default boolean highlightCollectorEggs() { return false; }
|
||||
default boolean showEggCount()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTotalRewards",
|
||||
name = "Summarize total reward points",
|
||||
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
||||
position = 7
|
||||
keyName = "showEggCountOverlay",
|
||||
name = "Overlay of eggs counted",
|
||||
description = "Display current egg count as collector",
|
||||
position = 3
|
||||
)
|
||||
default boolean showTotalRewards(){ return false; };
|
||||
default boolean showEggCountOverlay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showSummaryOfPoints",
|
||||
name = "Display summary of advanced points",
|
||||
description = "Gives summary of advanced points breakdown in chat log",
|
||||
position = 8
|
||||
)
|
||||
default boolean showSummaryOfPoints() { return false; };
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "wrongPoisonFoodTextColor",
|
||||
name = "Change healer wrong poison pack color",
|
||||
description = "Change healer wrong poison pack color",
|
||||
position = 9
|
||||
keyName = "showHpCountMessage",
|
||||
name = "Show count of Hp healed as healer.",
|
||||
description = "Display healed count as healer after each wave",
|
||||
position = 4
|
||||
)
|
||||
default Color wrongPoisonFoodTextColor() { return Color.BLACK;}
|
||||
default boolean showHpCount()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightItems",
|
||||
name = "Highlight called poison/bait",
|
||||
description = "Highlights the poison or bait that was called by your teammate",
|
||||
position = 10
|
||||
@ConfigItem(
|
||||
keyName = "showHpCountOverlay",
|
||||
name = "Overlay of Hp counted",
|
||||
description = "Display current healed count as healer",
|
||||
position = 5
|
||||
)
|
||||
default boolean showHpCountOverlay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightCollectorEggs",
|
||||
name = "Highlight collector eggs",
|
||||
description = "Highlight called egg colors",
|
||||
position = 6
|
||||
)
|
||||
default boolean highlightCollectorEggs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTotalRewards",
|
||||
name = "Summarize total reward points",
|
||||
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
||||
position = 7
|
||||
)
|
||||
default boolean showTotalRewards()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showSummaryOfPoints",
|
||||
name = "Display summary of advanced points",
|
||||
description = "Gives summary of advanced points breakdown in chat log",
|
||||
position = 8
|
||||
)
|
||||
default boolean showSummaryOfPoints()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "wrongPoisonFoodTextColor",
|
||||
name = "Change healer wrong poison pack color",
|
||||
description = "Change healer wrong poison pack color",
|
||||
position = 9
|
||||
)
|
||||
default Color wrongPoisonFoodTextColor()
|
||||
{
|
||||
return Color.BLACK;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightItems",
|
||||
name = "Highlight called poison/bait",
|
||||
description = "Highlights the poison or bait that was called by your teammate",
|
||||
position = 10
|
||||
)
|
||||
default boolean highlightItems()
|
||||
{
|
||||
@@ -124,10 +154,10 @@ public interface BarbarianAssaultConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightColor",
|
||||
name = "Highlight color",
|
||||
description = "Configures the color to highlight the called poison/bait",
|
||||
position = 11
|
||||
keyName = "highlightColor",
|
||||
name = "Highlight color",
|
||||
description = "Configures the color to highlight the called poison/bait",
|
||||
position = 11
|
||||
)
|
||||
default Color highlightColor()
|
||||
{
|
||||
|
||||
@@ -31,8 +31,8 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Stroke;
|
||||
import java.util.Map;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -60,9 +60,9 @@ import net.runelite.client.util.ImageUtil;
|
||||
class BarbarianAssaultOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_EGG_DISTANCE = 2500;
|
||||
private final int HEALTH_BAR_HEIGHT = 20;
|
||||
private final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
|
||||
private static final Color BACKGROUND = new Color(0, 0, 0, 150);
|
||||
private final int HEALTH_BAR_HEIGHT = 20;
|
||||
private final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
|
||||
private static final Color BACKGROUND = new Color(0, 0, 0, 150);
|
||||
private static final int OFFSET_Z = 20;
|
||||
|
||||
private final Client client;
|
||||
@@ -124,13 +124,15 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
graphics.drawImage(plugin.getClockImage(), spriteBounds.x, spriteBounds.y, null);
|
||||
}
|
||||
|
||||
if (role == Role.COLLECTOR && config.highlightCollectorEggs()) {
|
||||
if (role == Role.COLLECTOR && config.highlightCollectorEggs())
|
||||
{
|
||||
String heardCall = plugin.getCollectorHeardCall();
|
||||
Color highlightColor = BarbarianAssaultPlugin.getEggColor(heardCall);
|
||||
Map<WorldPoint, Integer> calledEggMap = plugin.getCalledEggMap();
|
||||
Map<WorldPoint, Integer> yellowEggMap = plugin.getYellowEggs();
|
||||
|
||||
if (calledEggMap != null) {
|
||||
if (calledEggMap != null)
|
||||
{
|
||||
renderEggLocations(graphics, calledEggMap, highlightColor);
|
||||
}
|
||||
|
||||
@@ -139,10 +141,12 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
}
|
||||
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
||||
|
||||
if (config.highlightItems() && inventory != null && !inventory.isHidden() && ((role == Role.DEFENDER || role == Role.HEALER))) {
|
||||
if (config.highlightItems() && inventory != null && !inventory.isHidden() && ((role == Role.DEFENDER || role == Role.HEALER)))
|
||||
{
|
||||
int listenItemId = plugin.getListenItemId(role.getListen());
|
||||
|
||||
if (listenItemId != -1) {
|
||||
if (listenItemId != -1)
|
||||
{
|
||||
Color color = config.highlightColor();
|
||||
BufferedImage highlight = ImageUtil.fillImage(itemManager.getImage(listenItemId), new Color(color.getRed(), color.getGreen(), color.getBlue(), 150));
|
||||
|
||||
@@ -156,47 +160,47 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
if (role == Role.HEALER)
|
||||
{
|
||||
for (HealerTeam teammate : HealerTeam.values())
|
||||
{
|
||||
Widget widget = client.getWidget(teammate.getTeammate());
|
||||
if (widget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (role == Role.HEALER)
|
||||
{
|
||||
for (HealerTeam teammate : HealerTeam.values())
|
||||
{
|
||||
Widget widget = client.getWidget(teammate.getTeammate());
|
||||
if (widget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] teammateHealth = widget.getText().split(" / ");
|
||||
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
||||
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
||||
String[] teammateHealth = widget.getText().split(" / ");
|
||||
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
||||
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
||||
|
||||
int width = teammate.getWidth();
|
||||
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
||||
int width = teammate.getWidth();
|
||||
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
||||
|
||||
int offsetX = teammate.getOffset().getX();
|
||||
int offsetY = teammate.getOffset().getY();
|
||||
int x = widget.getCanvasLocation().getX() - offsetX;
|
||||
int y = widget.getCanvasLocation().getY() - offsetY;
|
||||
int offsetX = teammate.getOffset().getX();
|
||||
int offsetY = teammate.getOffset().getY();
|
||||
int x = widget.getCanvasLocation().getX() - offsetX;
|
||||
int y = widget.getCanvasLocation().getY() - offsetY;
|
||||
|
||||
graphics.setColor(HEALTH_BAR_COLOR);
|
||||
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
graphics.setColor(HEALTH_BAR_COLOR);
|
||||
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int getBarWidth(int base, int current, int size)
|
||||
{
|
||||
final double ratio = (double) current / base;
|
||||
private static int getBarWidth(int base, int current, int size)
|
||||
{
|
||||
final double ratio = (double) current / base;
|
||||
|
||||
if (ratio >= 1)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
if (ratio >= 1)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
return (int) Math.round(ratio * size);
|
||||
}
|
||||
return (int) Math.round(ratio * size);
|
||||
}
|
||||
|
||||
private void renderEggLocations(Graphics2D graphics, Map<WorldPoint, Integer> eggMap, Color color)
|
||||
{
|
||||
|
||||
@@ -29,27 +29,35 @@ import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.ItemDespawned;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -67,16 +75,15 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Barbarian Assault+",
|
||||
description = "Custom barbarian assault plugin, use along with BA Tools",
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
|
||||
name = "Barbarian Assault+",
|
||||
description = "Custom barbarian assault plugin, use along with BA Tools",
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
|
||||
)
|
||||
public class BarbarianAssaultPlugin extends Plugin
|
||||
{
|
||||
@@ -86,19 +93,24 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
|
||||
@Getter
|
||||
private int collectedEggCount = 0;
|
||||
|
||||
@Getter
|
||||
private int positiveEggCount = 0;
|
||||
|
||||
@Getter
|
||||
private int wrongEggs = 0;
|
||||
|
||||
@Getter
|
||||
private int HpHealed = 0;
|
||||
|
||||
@Getter
|
||||
private int totalCollectedEggCount = 0;
|
||||
|
||||
@Getter
|
||||
private int totalHpHealed = 0;
|
||||
|
||||
private boolean hasAnnounced;
|
||||
private Font font;
|
||||
private Font font;
|
||||
private final Image clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
||||
private int inGameBit = 0;
|
||||
private String currentWave = START_WAVE;
|
||||
@@ -116,7 +128,6 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final HashMap<WorldPoint, Integer> yellowEggs = new HashMap<>();
|
||||
|
||||
|
||||
@Inject
|
||||
@Getter
|
||||
private Client client;
|
||||
@@ -133,45 +144,20 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
@Inject
|
||||
private BarbarianAssaultOverlay overlay;
|
||||
|
||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
);
|
||||
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
||||
//base
|
||||
WidgetInfo.BA_BASE_POINTS,
|
||||
//att
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||
WidgetInfo.BA_RANGERS_KILLED,
|
||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||
//def
|
||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||
WidgetInfo.BA_RUNNERS_KILLED,
|
||||
//coll
|
||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||
//heal
|
||||
WidgetInfo.BA_HEALERS_KILLED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||
);
|
||||
|
||||
@Provides
|
||||
@Provides
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||
}
|
||||
|
||||
private Game game;
|
||||
private Wave wave;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
font = FontManager.getRunescapeFont()
|
||||
.deriveFont(Font.BOLD, 24);
|
||||
.deriveFont(Font.BOLD, 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,12 +188,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
|
||||
{
|
||||
wave = new Wave(client);
|
||||
Wave wave = new Wave(client);
|
||||
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||
if (rewardWidget != null && rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && gameTime != null)
|
||||
{
|
||||
if (config.waveTimes())
|
||||
{
|
||||
announceTime("Game finished, duration: ", gameTime.getTime(false));
|
||||
}
|
||||
if (config.showTotalRewards())
|
||||
{
|
||||
announceSomething(game.getGameSummary());
|
||||
@@ -215,7 +203,7 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
}
|
||||
Widget pointsWidget = client.getWidget(WidgetInfo.BA_RUNNERS_PASSED);
|
||||
if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && pointsWidget != null
|
||||
&& config.showSummaryOfPoints() && !hasAnnounced && client.getVar(Varbits.IN_GAME_BA) == 0)
|
||||
&& config.showSummaryOfPoints() && !hasAnnounced && client.getVar(Varbits.IN_GAME_BA) == 0)
|
||||
{
|
||||
wave.setWaveAmounts();
|
||||
wave.setWavePoints();
|
||||
@@ -249,13 +237,15 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
{
|
||||
hasAnnounced = true;
|
||||
}
|
||||
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int inGame = client.getVar(Varbits.IN_GAME_BA);
|
||||
if (inGameBit != inGame)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final String message = chatMessage.getMessage().toLowerCase();
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
final String nodeValue = Text.removeTags(messageNode.getValue());
|
||||
@@ -368,13 +358,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
|
||||
inGameBit = inGame;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
int itemId = itemSpawned.getItem().getId();
|
||||
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
|
||||
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
|
||||
if (eggMap != null)
|
||||
if (eggMap != null)
|
||||
{
|
||||
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
|
||||
if (existingQuantity != null)
|
||||
@@ -470,9 +461,9 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
private void announceSomething(final ChatMessageBuilder chatMessage)
|
||||
{
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage(chatMessage.build())
|
||||
.build());
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage(chatMessage.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
String getCollectorHeardCall()
|
||||
@@ -570,26 +561,22 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
private void announceTime(String preText, String time)
|
||||
{
|
||||
final String chatMessage = new ChatMessageBuilder()
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(preText)
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(time)
|
||||
.build();
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(preText)
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(time)
|
||||
.build();
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage(chatMessage)
|
||||
.build());
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage(chatMessage)
|
||||
.build());
|
||||
}
|
||||
|
||||
private boolean isEgg(int itemID)
|
||||
{
|
||||
if (itemID == ItemID.RED_EGG || itemID == ItemID.GREEN_EGG
|
||||
|| itemID == ItemID.BLUE_EGG || itemID == ItemID.YELLOW_EGG)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return itemID == ItemID.RED_EGG || itemID == ItemID.GREEN_EGG
|
||||
|| itemID == ItemID.BLUE_EGG || itemID == ItemID.YELLOW_EGG;
|
||||
}
|
||||
|
||||
private boolean isUnderPlayer(Tile tile)
|
||||
@@ -616,12 +603,12 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
return font;
|
||||
}
|
||||
|
||||
public Image getClockImage()
|
||||
Image getClockImage()
|
||||
{
|
||||
return clockImage;
|
||||
}
|
||||
|
||||
public int getListenItemId(WidgetInfo listenInfo)
|
||||
int getListenItemId(WidgetInfo listenInfo)
|
||||
{
|
||||
Widget listenWidget = client.getWidget(listenInfo);
|
||||
|
||||
|
||||
@@ -24,120 +24,124 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Getter
|
||||
public class Game
|
||||
{
|
||||
private Client client;
|
||||
private String currentWave;
|
||||
private ArrayList<Wave> waves = new ArrayList<>();
|
||||
private String[] totalDescriptions = {
|
||||
"A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; Vial: ",
|
||||
"; H packs: ",
|
||||
"; Total: "};
|
||||
private String[] otherPointsDescriptions = {
|
||||
" A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; H: "
|
||||
};
|
||||
private int[] totalPoints = new int[6];
|
||||
private int[] totalAmounts = new int[6];
|
||||
private int[] otherRolesPoints = new int[4];
|
||||
private Client client;
|
||||
private String currentWave;
|
||||
private ArrayList<Wave> waves = new ArrayList<>();
|
||||
private String[] totalDescriptions = {
|
||||
"A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; Vial: ",
|
||||
"; H packs: ",
|
||||
"; Total: "};
|
||||
private String[] otherPointsDescriptions = {
|
||||
" A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; H: "
|
||||
};
|
||||
private int[] totalPoints = new int[6];
|
||||
private int[] totalAmounts = new int[6];
|
||||
private int[] otherRolesPoints = new int[4];
|
||||
|
||||
Game(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
Game(Client client, ArrayList<Wave> waves)
|
||||
{
|
||||
this.client = client;
|
||||
this.waves = waves;
|
||||
}
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (chatMessage.getMessage().startsWith("---- Wave:"))
|
||||
{
|
||||
String[] tempMessage = chatMessage.getMessage().split(" ");
|
||||
currentWave = tempMessage[2];
|
||||
String[] temp = currentWave.split(" ");
|
||||
}
|
||||
if (currentWave.equals("1"))
|
||||
{
|
||||
waves = null;
|
||||
totalPoints = new int[6];
|
||||
totalAmounts = new int[6];
|
||||
}
|
||||
}
|
||||
ChatMessageBuilder getGameSummary()
|
||||
{
|
||||
int[] amountsList;
|
||||
int[] pointsList;
|
||||
int[] otherRolesPointsList;
|
||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||
message.append("Round points: ");
|
||||
for (Wave w : waves)
|
||||
{
|
||||
amountsList = w.getWaveAmounts();
|
||||
pointsList = w.getWavePoints();
|
||||
otherRolesPointsList = w.getOtherRolesPointsList();
|
||||
for (int j = 0; j < totalAmounts.length; j++) {
|
||||
totalAmounts[j] += amountsList[j];
|
||||
}
|
||||
for (int k = 0; k < totalPoints.length; k++) {
|
||||
totalPoints[k] += pointsList[k];
|
||||
}
|
||||
for (int z = 0; z < otherRolesPoints.length; z++) {
|
||||
otherRolesPoints[z] += otherRolesPointsList[z];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
||||
{
|
||||
otherRolesPoints[i] += 80;
|
||||
}
|
||||
totalAmounts[5] += 80;
|
||||
for (int i = 0; i < totalDescriptions.length; i++)
|
||||
{
|
||||
if (i != 4)
|
||||
{
|
||||
message.append(totalDescriptions[i]);
|
||||
message.append(String.valueOf(totalAmounts[i]));
|
||||
message.append("(");
|
||||
if (totalPoints[i] < 0)
|
||||
{
|
||||
message.append(Color.RED, String.valueOf(totalPoints[i]));
|
||||
}
|
||||
else if (totalPoints[i] > 0)
|
||||
{
|
||||
message.append(Color.BLUE, String.valueOf(totalPoints[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append(String.valueOf(totalPoints[i]));
|
||||
}
|
||||
message.append(")");
|
||||
}
|
||||
}
|
||||
message.append(System.getProperty("line.separator"));
|
||||
message.append("All roles points this game: ");
|
||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
||||
{
|
||||
message.append(otherPointsDescriptions[i]);
|
||||
message.append(String.valueOf(otherRolesPoints[i]));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
Game(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
Game(Client client, ArrayList<Wave> waves)
|
||||
{
|
||||
this.client = client;
|
||||
this.waves = waves;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (chatMessage.getMessage().startsWith("---- Wave:"))
|
||||
{
|
||||
String[] tempMessage = chatMessage.getMessage().split(" ");
|
||||
currentWave = tempMessage[2];
|
||||
String[] temp = currentWave.split(" ");
|
||||
}
|
||||
if (currentWave.equals("1"))
|
||||
{
|
||||
waves = null;
|
||||
totalPoints = new int[6];
|
||||
totalAmounts = new int[6];
|
||||
}
|
||||
}
|
||||
|
||||
ChatMessageBuilder getGameSummary()
|
||||
{
|
||||
int[] amountsList;
|
||||
int[] pointsList;
|
||||
int[] otherRolesPointsList;
|
||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||
message.append("Round points: ");
|
||||
for (Wave w : waves)
|
||||
{
|
||||
amountsList = w.getWaveAmounts();
|
||||
pointsList = w.getWavePoints();
|
||||
otherRolesPointsList = w.getOtherRolesPointsList();
|
||||
for (int j = 0; j < totalAmounts.length; j++)
|
||||
{
|
||||
totalAmounts[j] += amountsList[j];
|
||||
}
|
||||
for (int k = 0; k < totalPoints.length; k++)
|
||||
{
|
||||
totalPoints[k] += pointsList[k];
|
||||
}
|
||||
for (int z = 0; z < otherRolesPoints.length; z++)
|
||||
{
|
||||
otherRolesPoints[z] += otherRolesPointsList[z];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
||||
{
|
||||
otherRolesPoints[i] += 80;
|
||||
}
|
||||
totalAmounts[5] += 80;
|
||||
for (int i = 0; i < totalDescriptions.length; i++)
|
||||
{
|
||||
if (i != 4)
|
||||
{
|
||||
message.append(totalDescriptions[i]);
|
||||
message.append(String.valueOf(totalAmounts[i]));
|
||||
message.append("(");
|
||||
if (totalPoints[i] < 0)
|
||||
{
|
||||
message.append(Color.RED, String.valueOf(totalPoints[i]));
|
||||
}
|
||||
else if (totalPoints[i] > 0)
|
||||
{
|
||||
message.append(Color.BLUE, String.valueOf(totalPoints[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append(String.valueOf(totalPoints[i]));
|
||||
}
|
||||
message.append(")");
|
||||
}
|
||||
}
|
||||
message.append(System.getProperty("line.separator"));
|
||||
message.append("All roles points this game: ");
|
||||
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||
{
|
||||
message.append(otherPointsDescriptions[i]);
|
||||
message.append(String.valueOf(otherRolesPoints[i]));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,13 @@ enum Role
|
||||
|
||||
@Getter
|
||||
private final WidgetInfo listen;
|
||||
|
||||
@Getter
|
||||
private final WidgetInfo call;
|
||||
|
||||
@Getter
|
||||
private final WidgetInfo roleText;
|
||||
|
||||
@Getter
|
||||
private final WidgetInfo roleSprite;
|
||||
|
||||
|
||||
@@ -34,17 +34,22 @@ import net.runelite.api.Constants;
|
||||
class Round
|
||||
{
|
||||
private final Instant roundStartTime;
|
||||
|
||||
@Getter
|
||||
private final Role roundRole;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean runnersKilled;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean rangersKilled;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean healersKilled;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean fightersKilled;
|
||||
@@ -56,12 +61,7 @@ class Round
|
||||
this.roundStartTime = Instant.now().plusMillis(2 * Constants.GAME_TICK_LENGTH);
|
||||
}
|
||||
|
||||
public long getRoundTime()
|
||||
{
|
||||
return Duration.between(roundStartTime, Instant.now()).getSeconds();
|
||||
}
|
||||
|
||||
public long getTimeToChange()
|
||||
long getTimeToChange()
|
||||
{
|
||||
return 30 + (Duration.between(Instant.now(), roundStartTime).getSeconds() % 30);
|
||||
}
|
||||
|
||||
@@ -25,193 +25,186 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.awt.Color;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
|
||||
@Getter
|
||||
class Wave
|
||||
{
|
||||
private Client client;
|
||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
);
|
||||
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
||||
//base
|
||||
WidgetInfo.BA_BASE_POINTS,
|
||||
//att
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||
WidgetInfo.BA_RANGERS_KILLED,
|
||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||
//def
|
||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||
WidgetInfo.BA_RUNNERS_KILLED,
|
||||
//coll
|
||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||
//heal
|
||||
WidgetInfo.BA_HEALERS_KILLED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||
);
|
||||
private int[] waveAmounts = new int[6];
|
||||
private int[] allPointsList = new int[10];
|
||||
private int[] wavePoints = new int[6];
|
||||
private int[] otherRolesPointsList = new int[4];
|
||||
private String[] descriptions = {
|
||||
" A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; Vial: ",
|
||||
"; H packs: ",
|
||||
"; Total: "};
|
||||
private Client client;
|
||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
);
|
||||
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
||||
//base
|
||||
WidgetInfo.BA_BASE_POINTS,
|
||||
//att
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||
WidgetInfo.BA_RANGERS_KILLED,
|
||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||
//def
|
||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||
WidgetInfo.BA_RUNNERS_KILLED,
|
||||
//coll
|
||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||
//heal
|
||||
WidgetInfo.BA_HEALERS_KILLED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||
);
|
||||
private int[] waveAmounts = new int[6];
|
||||
private int[] allPointsList = new int[10];
|
||||
private int[] wavePoints = new int[6];
|
||||
private int[] otherRolesPointsList = new int[4];
|
||||
private String[] descriptions = {
|
||||
" A: ",
|
||||
"; D: ",
|
||||
"; C: ",
|
||||
"; Vial: ",
|
||||
"; H packs: ",
|
||||
"; Total: "};
|
||||
|
||||
private String[] otherPointsDescriptions = {
|
||||
" A: ",
|
||||
" D: ",
|
||||
" C: ",
|
||||
" H: "
|
||||
};
|
||||
Wave(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
void setWaveAmounts(int[] amounts)
|
||||
{
|
||||
for (int i = 0; i < amounts.length; i++)
|
||||
{
|
||||
waveAmounts[i] = amounts[i];
|
||||
}
|
||||
}
|
||||
private String[] otherPointsDescriptions = {
|
||||
" A: ",
|
||||
" D: ",
|
||||
" C: ",
|
||||
" H: "
|
||||
};
|
||||
|
||||
void setWavePoints(int[] points, int[] otherRolesPoints)
|
||||
{
|
||||
for (int i = 0; i < points.length; i++)
|
||||
{
|
||||
wavePoints[i] = points[i];
|
||||
}
|
||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
||||
{
|
||||
otherRolesPointsList[i] = otherRolesPoints[i];
|
||||
}
|
||||
}
|
||||
void setWaveAmounts()
|
||||
{
|
||||
for (int i = 0; i < WIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(WIDGETS.get(i));
|
||||
if (w != null)
|
||||
{
|
||||
waveAmounts[i] = Integer.parseInt(w.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
void setWavePoints()
|
||||
{
|
||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||
allPointsList[i] = Integer.parseInt(w.getText());
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
wavePoints[0] += allPointsList[i];
|
||||
break;
|
||||
case 4:
|
||||
wavePoints[1] += allPointsList[i];
|
||||
break;
|
||||
case 6:
|
||||
wavePoints[2] += allPointsList[i];
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
wavePoints[3] += allPointsList[i];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
wavePoints[5] = 0;
|
||||
for (int i = 0; i < wavePoints.length-1; i++)
|
||||
{
|
||||
wavePoints[5] += wavePoints[i];
|
||||
}
|
||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 6:
|
||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ChatMessageBuilder getWaveSummary()
|
||||
{
|
||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||
message.append("Wave points:");
|
||||
for(int i = 0; i < descriptions.length; i++)
|
||||
{
|
||||
if (i != 4)
|
||||
{
|
||||
message.append(descriptions[i]);
|
||||
message.append(String.valueOf(waveAmounts[i]));
|
||||
message.append("(");
|
||||
if (wavePoints[i] < 0)
|
||||
{
|
||||
message.append(Color.RED, String.valueOf(wavePoints[i]));
|
||||
}
|
||||
else if (wavePoints[i] > 0)
|
||||
{
|
||||
message.append(Color.BLUE, String.valueOf(wavePoints[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append(String.valueOf(wavePoints[i]));
|
||||
}
|
||||
message.append(")");
|
||||
}
|
||||
}
|
||||
message.append(System.getProperty("line.separator"));
|
||||
message.append("All roles points this wave: ");
|
||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
||||
{
|
||||
message.append(otherPointsDescriptions[i]);
|
||||
message.append(String.valueOf(otherRolesPointsList[i]));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
Wave(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
void setWaveAmounts(int[] amounts)
|
||||
{
|
||||
System.arraycopy(amounts, 0, waveAmounts, 0, amounts.length);
|
||||
}
|
||||
|
||||
void setWavePoints(int[] points, int[] otherRolesPoints)
|
||||
{
|
||||
System.arraycopy(points, 0, wavePoints, 0, points.length);
|
||||
System.arraycopy(otherRolesPoints, 0, otherRolesPointsList, 0, otherRolesPoints.length);
|
||||
}
|
||||
|
||||
void setWaveAmounts()
|
||||
{
|
||||
for (int i = 0; i < WIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(WIDGETS.get(i));
|
||||
if (w != null)
|
||||
{
|
||||
waveAmounts[i] = Integer.parseInt(w.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setWavePoints()
|
||||
{
|
||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||
allPointsList[i] = Integer.parseInt(w.getText());
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
wavePoints[0] += allPointsList[i];
|
||||
break;
|
||||
case 4:
|
||||
wavePoints[1] += allPointsList[i];
|
||||
break;
|
||||
case 6:
|
||||
wavePoints[2] += allPointsList[i];
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
wavePoints[3] += allPointsList[i];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
wavePoints[5] = 0;
|
||||
for (int i = 0; i < wavePoints.length - 1; i++)
|
||||
{
|
||||
wavePoints[5] += wavePoints[i];
|
||||
}
|
||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 6:
|
||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ChatMessageBuilder getWaveSummary()
|
||||
{
|
||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||
message.append("Wave points:");
|
||||
for (int i = 0; i < descriptions.length; i++)
|
||||
{
|
||||
if (i != 4)
|
||||
{
|
||||
message.append(descriptions[i]);
|
||||
message.append(String.valueOf(waveAmounts[i]));
|
||||
message.append("(");
|
||||
if (wavePoints[i] < 0)
|
||||
{
|
||||
message.append(Color.RED, String.valueOf(wavePoints[i]));
|
||||
}
|
||||
else if (wavePoints[i] > 0)
|
||||
{
|
||||
message.append(Color.BLUE, String.valueOf(wavePoints[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append(String.valueOf(wavePoints[i]));
|
||||
}
|
||||
message.append(")");
|
||||
}
|
||||
}
|
||||
message.append(System.getProperty("line.separator"));
|
||||
message.append("All roles points this wave: ");
|
||||
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||
{
|
||||
message.append(otherPointsDescriptions[i]);
|
||||
message.append(String.valueOf(otherRolesPointsList[i]));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ import net.runelite.client.config.ConfigItem;
|
||||
public interface BAToolsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "defTimer",
|
||||
name = "Defender Tick Timer",
|
||||
description = "Shows the current cycle tick of runners."
|
||||
keyName = "defTimer",
|
||||
name = "Defender Tick Timer",
|
||||
description = "Shows the current cycle tick of runners."
|
||||
)
|
||||
default boolean defTimer()
|
||||
{
|
||||
@@ -42,9 +42,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "calls",
|
||||
name = "Remove Incorrect Calls",
|
||||
description = "Remove incorrect calls."
|
||||
keyName = "calls",
|
||||
name = "Remove Incorrect Calls",
|
||||
description = "Remove incorrect calls."
|
||||
)
|
||||
default boolean calls()
|
||||
{
|
||||
@@ -52,9 +52,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "swapLadder",
|
||||
name = "Swap ladder option",
|
||||
description = "Swap Climb-down with Quick-start in the wave lobbies"
|
||||
keyName = "swapLadder",
|
||||
name = "Swap ladder option",
|
||||
description = "Swap Climb-down with Quick-start in the wave lobbies"
|
||||
)
|
||||
default boolean swapLadder()
|
||||
{
|
||||
@@ -62,9 +62,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "healerCodes",
|
||||
name = "Healer Codes",
|
||||
description = "Overlay to show healer codes"
|
||||
keyName = "healerCodes",
|
||||
name = "Healer Codes",
|
||||
description = "Overlay to show healer codes"
|
||||
)
|
||||
default boolean healerCodes()
|
||||
{
|
||||
@@ -72,9 +72,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "healerMenuOption",
|
||||
name = "Healer menu options",
|
||||
description = "asd"
|
||||
keyName = "healerMenuOption",
|
||||
name = "Healer menu options",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean healerMenuOption()
|
||||
{
|
||||
@@ -82,9 +82,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "antiDrag",
|
||||
name = "Anti Drag",
|
||||
description = "asd"
|
||||
keyName = "antiDrag",
|
||||
name = "Anti Drag",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean antiDrag()
|
||||
{
|
||||
@@ -92,9 +92,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "antiDragDelay",
|
||||
name = "Anti Drag Delay",
|
||||
description = "asd"
|
||||
keyName = "antiDragDelay",
|
||||
name = "Anti Drag Delay",
|
||||
description = "asd"
|
||||
)
|
||||
default int antiDragDelay()
|
||||
{
|
||||
@@ -102,9 +102,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "eggBoi",
|
||||
name = "Collector helper",
|
||||
description = "asd"
|
||||
keyName = "eggBoi",
|
||||
name = "Collector helper",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean eggBoi()
|
||||
{
|
||||
@@ -112,9 +112,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "osHelp",
|
||||
name = "Shift OS",
|
||||
description = "asd"
|
||||
keyName = "osHelp",
|
||||
name = "Shift OS",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean osHelp()
|
||||
{
|
||||
@@ -122,9 +122,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "prayerMetronome",
|
||||
name = "Prayer Metronome",
|
||||
description = "asd"
|
||||
keyName = "prayerMetronome",
|
||||
name = "Prayer Metronome",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean prayerMetronome()
|
||||
{
|
||||
@@ -132,9 +132,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "prayerMetronomeVolume",
|
||||
name = "Prayer Metronome Volume",
|
||||
description = "asd"
|
||||
keyName = "prayerMetronomeVolume",
|
||||
name = "Prayer Metronome Volume",
|
||||
description = "asd"
|
||||
)
|
||||
default int prayerMetronomeVolume()
|
||||
{
|
||||
@@ -142,9 +142,9 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "attackStyles",
|
||||
name = "Attack Styles",
|
||||
description = "Hide attack styles depending on weapon."
|
||||
keyName = "attackStyles",
|
||||
name = "Attack Styles",
|
||||
description = "Hide attack styles depending on weapon."
|
||||
)
|
||||
default boolean attackStyles()
|
||||
{
|
||||
@@ -152,24 +152,33 @@ public interface BAToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "removeBA",
|
||||
name = "*Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
keyName = "removeBA",
|
||||
name = "*Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
)
|
||||
default boolean removeBA() { return true; }
|
||||
default boolean removeBA()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "removeWrongEggs",
|
||||
name = "Remove wrong eggs - *Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
keyName = "removeWrongEggs",
|
||||
name = "Remove wrong eggs - *Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
)
|
||||
default boolean removeWrongEggs() { return false; }
|
||||
default boolean removeWrongEggs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "removeWrongHealFood",
|
||||
name = "Remove wrong Heal Food - *Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
keyName = "removeWrongHealFood",
|
||||
name = "Remove wrong Heal Food - *Barbarian Assault Helper*",
|
||||
description = "Remove unnecessary menu options in Barbarian Assault depending on role<br>Examples: Remove attack options when not attacker<br>Remove take options when not collector"
|
||||
)
|
||||
default boolean removeHealWrongFood() { return false; }
|
||||
default boolean removeHealWrongFood()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,16 +27,17 @@ package net.runelite.client.plugins.batools;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
@Slf4j
|
||||
|
||||
public class BAToolsOverlay extends Overlay
|
||||
@@ -52,16 +53,14 @@ public class BAToolsOverlay extends Overlay
|
||||
private static final Color GRAY = new Color(158, 158, 158);
|
||||
|
||||
private final BAToolsConfig config;
|
||||
private Client client;
|
||||
private BAToolsPlugin plugin;
|
||||
|
||||
@Inject
|
||||
public BAToolsOverlay(Client client, BAToolsPlugin plugin, BAToolsConfig config)
|
||||
public BAToolsOverlay(BAToolsPlugin plugin, BAToolsConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -69,37 +68,24 @@ public class BAToolsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if(!config.healerCodes())
|
||||
if (!config.healerCodes())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Healer healer : plugin.getHealers().values())
|
||||
{
|
||||
NPCComposition composition = healer.getNpc().getComposition();
|
||||
Color color = composition.getCombatLevel() > 1 ? YELLOW : ORANGE;
|
||||
if (composition.getConfigs() != null)
|
||||
{
|
||||
NPCComposition transformedComposition = composition.transform();
|
||||
if (transformedComposition == null)
|
||||
{
|
||||
color = GRAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
composition = transformedComposition;
|
||||
}
|
||||
}
|
||||
int timeLeft = healer.getLastFoodTime() - (int)Duration.between(plugin.getWave_start(), Instant.now()).getSeconds();
|
||||
Color color;
|
||||
int timeLeft = healer.getLastFoodTime() - (int) Duration.between(plugin.getWave_start(), Instant.now()).getSeconds();
|
||||
timeLeft = timeLeft < 1 ? 0 : timeLeft;
|
||||
|
||||
if(healer.getFoodRemaining() > 1)
|
||||
if (healer.getFoodRemaining() > 1)
|
||||
{
|
||||
color = GREEN;
|
||||
}
|
||||
else if(healer.getFoodRemaining() == 1)
|
||||
else if (healer.getFoodRemaining() == 1)
|
||||
{
|
||||
if(timeLeft > 0)
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
color = RED;
|
||||
}
|
||||
@@ -118,7 +104,6 @@ public class BAToolsOverlay extends Overlay
|
||||
timeLeft);
|
||||
|
||||
|
||||
|
||||
OverlayUtil.renderActorOverlay(graphics, healer.getNpc(), text, color);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -24,18 +24,16 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.batools;
|
||||
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -47,6 +45,8 @@ import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
@@ -65,6 +65,7 @@ import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
@@ -79,16 +80,16 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "BA Tools",
|
||||
description = "Custom tools for Barbarian Assault",
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM
|
||||
name = "BA Tools",
|
||||
description = "Custom tools for Barbarian Assault",
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM
|
||||
)
|
||||
public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
int inGameBit = 0;
|
||||
int tickNum;
|
||||
int pastCall = 0;
|
||||
private int inGameBit = 0;
|
||||
private int tickNum;
|
||||
private int pastCall = 0;
|
||||
private int currentWave = 1;
|
||||
private static final int BA_WAVE_NUM_INDEX = 2;
|
||||
private final List<MenuEntry> entries = new ArrayList<>();
|
||||
@@ -101,12 +102,6 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@@ -166,16 +161,12 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
switch (event.getGroupId())
|
||||
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
|
||||
{
|
||||
case WidgetID.BA_REWARD_GROUP_ID:
|
||||
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||
if (rewardWidget != null && rewardWidget.getText().contains("<br>5"))
|
||||
{
|
||||
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||
|
||||
if (rewardWidget != null && rewardWidget.getText().contains("<br>5"))
|
||||
{
|
||||
tickNum = 0;
|
||||
}
|
||||
tickNum = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,38 +202,37 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
counter.setCount(tickNum);
|
||||
if (config.defTimer())
|
||||
{
|
||||
//log.info("" + tickNum++);
|
||||
tickNum++;
|
||||
}
|
||||
}
|
||||
|
||||
Widget weapon = client.getWidget(593, 1);
|
||||
|
||||
if(config.attackStyles()
|
||||
&& weapon!=null
|
||||
&& inGameBit == 1
|
||||
&& weapon.getText().contains("Crystal halberd") || weapon.getText().contains("Dragon claws")
|
||||
&& client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT)!=null)
|
||||
if (config.attackStyles()
|
||||
&& weapon != null
|
||||
&& inGameBit == 1
|
||||
&& weapon.getText().contains("Crystal halberd") || weapon.getText().contains("Dragon claws")
|
||||
&& client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT) != null)
|
||||
{
|
||||
String style = client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT).getText();
|
||||
|
||||
if(style.contains("Defensive"))
|
||||
if (style.contains("Defensive"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
|
||||
}
|
||||
else if(style.contains("Aggressive"))
|
||||
else if (style.contains("Aggressive"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
|
||||
}
|
||||
else if(style.contains("Controlled"))
|
||||
else if (style.contains("Controlled"))
|
||||
{
|
||||
if(weapon.getText().contains("Crystal halberd"))
|
||||
if (weapon.getText().contains("Crystal halberd"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
@@ -255,7 +245,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
|
||||
}
|
||||
else if(style.contains("Accurate") && weapon.getText().contains("Dragon claws"))
|
||||
else if (style.contains("Accurate") && weapon.getText().contains("Dragon claws"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
@@ -279,9 +269,9 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
|
||||
}
|
||||
|
||||
if(config.prayerMetronome() && isAnyPrayerActive())
|
||||
if (config.prayerMetronome() && isAnyPrayerActive())
|
||||
{
|
||||
for(int i = 0; i < config.prayerMetronomeVolume(); i++)
|
||||
for (int i = 0; i < config.prayerMetronomeVolume(); i++)
|
||||
{
|
||||
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP);
|
||||
}
|
||||
@@ -335,7 +325,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
if (event.getType() == ChatMessageType.GAMEMESSAGE
|
||||
&& event.getMessage().startsWith("---- Wave:"))
|
||||
&& event.getMessage().startsWith("---- Wave:"))
|
||||
{
|
||||
String[] message = event.getMessage().split(" ");
|
||||
currentWave = Integer.parseInt(message[BA_WAVE_NUM_INDEX]);
|
||||
@@ -355,7 +345,6 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
int spawnNumber = healers.size();
|
||||
healers.put(npc, new Healer(npc, spawnNumber, currentWave));
|
||||
//log.info("spawn number: " + spawnNumber + " on wave " + currentWave);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,24 +382,24 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
Actor opponent = event.getTarget();
|
||||
|
||||
if (opponent != null && opponent instanceof NPC && isNpcHealer(((NPC) opponent).getId()) && event.getSource() != client.getLocalPlayer())
|
||||
if (opponent instanceof NPC && isNpcHealer(((NPC) opponent).getId()) && event.getSource() != client.getLocalPlayer())
|
||||
{
|
||||
lastInteracted = opponent;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNpcHealer(int npcId)
|
||||
private static boolean isNpcHealer(int npcId)
|
||||
{
|
||||
return npcId == NpcID.PENANCE_HEALER ||
|
||||
npcId == NpcID.PENANCE_HEALER_5766 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5767 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5768 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5769 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5770 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5771 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5772 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5773 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5774;
|
||||
npcId == NpcID.PENANCE_HEALER_5766 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5767 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5768 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5769 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5770 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5771 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5772 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5773 ||
|
||||
npcId == NpcID.PENANCE_HEALER_5774;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -440,7 +429,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
if (correctCall != null) //&& callWidget.getTextColor()==16316664)
|
||||
{
|
||||
entries.add(correctCall);
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,24 +442,31 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
swap(client, "quick-start", option, target, true);
|
||||
}
|
||||
else if(config.removeBA() && client.getVar(Varbits.IN_GAME_BA) == 1 && !option.contains("tell-"))//if in barbarian assault and menu isnt from a horn
|
||||
else if (config.removeBA() && client.getVar(Varbits.IN_GAME_BA) == 1 && !option.contains("tell-"))//if in barbarian assault and menu isnt from a horn
|
||||
{
|
||||
if(itemId == ItemID.LOGS && !target.contains("healing vial"))
|
||||
if (itemId == ItemID.LOGS && !target.contains("healing vial"))
|
||||
{
|
||||
if(client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null)
|
||||
if (client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null)
|
||||
{
|
||||
remove(new String[]{"take", "light"}, target, true);
|
||||
}
|
||||
else//remove "Light" option (and "Take" option if not defender).
|
||||
{
|
||||
remove("light", target, true);
|
||||
}
|
||||
}
|
||||
else if(option.equals("use"))
|
||||
else if (option.equals("use"))
|
||||
{
|
||||
if (config.removeHealWrongFood()) {
|
||||
if (config.removeHealWrongFood())
|
||||
{
|
||||
Widget healer = client.getWidget(WidgetInfo.BA_HEAL_LISTEN_TEXT);
|
||||
if (healer != null) {
|
||||
if (healer != null)
|
||||
{
|
||||
String item = target.split("-")[0].trim();
|
||||
List<String> poison = Arrays.asList("poisoned tofu", "poisoned meat", "poisoned worms");
|
||||
List<String> vials = Arrays.asList("healing vial", "healing vial(1)", "healing vial(2)", "healing vial(3)", "healing vial(4)");//"healing vial(4)"
|
||||
if (poison.contains(item)) {//if item is a poison item
|
||||
if (poison.contains(item))
|
||||
{//if item is a poison item
|
||||
int calledPoison = 0;
|
||||
switch (healer.getText())//choose which poison to hide the use/destroy option for
|
||||
{
|
||||
@@ -491,10 +487,13 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
remove(new String[]{"use", "destroy", "examine"}, target, true);//remove options
|
||||
}
|
||||
} else if (!target.contains("penance healer")) {
|
||||
}
|
||||
else if (!target.contains("penance healer"))
|
||||
{
|
||||
remove(option, target, true);
|
||||
}
|
||||
} else if (vials.contains(item))//if item is the healer's healing vial
|
||||
}
|
||||
else if (vials.contains(item))//if item is the healer's healing vial
|
||||
{
|
||||
|
||||
if (!target.equals(item))//if target is not the vial itself
|
||||
@@ -509,26 +508,26 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(option.equals("attack") && client.getWidget(WidgetInfo.BA_ATK_ROLE_TEXT) == null && !target.equals("queen spawn"))//if not attacker
|
||||
else if (option.equals("attack") && client.getWidget(WidgetInfo.BA_ATK_ROLE_TEXT) == null && !target.equals("queen spawn"))//if not attacker
|
||||
{//remove attack option from everything but queen spawns
|
||||
remove(option, target, true);
|
||||
}
|
||||
else if((option.equals("fix") || (option.equals("block") && target.equals("penance cave"))) && client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null)//if not defender
|
||||
else if ((option.equals("fix") || (option.equals("block") && target.equals("penance cave"))) && client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null)//if not defender
|
||||
{//the check for option requires checking target as well because defensive attack style option is also called "block".
|
||||
remove(option, target, true);
|
||||
}
|
||||
else if((option.equals("load")) && client.getWidget(WidgetInfo.BA_COLL_ROLE_TEXT) == null)//if not collector, remove hopper options
|
||||
else if ((option.equals("load")) && client.getWidget(WidgetInfo.BA_COLL_ROLE_TEXT) == null)//if not collector, remove hopper options
|
||||
{
|
||||
remove(new String[]{option, "look-in"}, target, true);
|
||||
}
|
||||
else if(config.removeWrongEggs() && option.equals("take"))
|
||||
else if (config.removeWrongEggs() && option.equals("take"))
|
||||
{
|
||||
Widget eggToColl = client.getWidget(WidgetInfo.BA_COLL_LISTEN_TEXT);
|
||||
if(eggToColl != null)//if we're a collector
|
||||
if (eggToColl != null)//if we're a collector
|
||||
{
|
||||
List<Integer> eggsToHide = new ArrayList<>();
|
||||
eggsToHide.add(ItemID.HAMMER);
|
||||
switch(eggToColl.getText())//choose which eggs to hide take option for
|
||||
switch (eggToColl.getText())//choose which eggs to hide take option for
|
||||
{
|
||||
case "Red eggs":
|
||||
eggsToHide.add(ItemID.BLUE_EGG);
|
||||
@@ -543,7 +542,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
eggsToHide.add(ItemID.BLUE_EGG);
|
||||
break;
|
||||
}
|
||||
if(eggsToHide.contains(itemId))
|
||||
if (eggsToHide.contains(itemId))
|
||||
{
|
||||
remove(option, target, true);//hide wrong eggs
|
||||
}
|
||||
@@ -551,7 +550,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
else
|
||||
{
|
||||
List<Integer> defenderItems = Arrays.asList(ItemID.HAMMER, ItemID.TOFU, ItemID.CRACKERS, ItemID.WORMS);//logs are handled separately due to hiding "light" option too.
|
||||
if(client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null || !defenderItems.contains(itemId))//if not defender, or item is not a defenderItem
|
||||
if (client.getWidget(WidgetInfo.BA_DEF_ROLE_TEXT) == null || !defenderItems.contains(itemId))//if not defender, or item is not a defenderItem
|
||||
{
|
||||
remove(option, target, true);//hide everything except hammer/logs and bait if Defender
|
||||
}
|
||||
@@ -587,7 +586,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
if (client.getWidget(WidgetInfo.BA_COLL_LISTEN_TEXT) != null && inGameBit == 1 && config.eggBoi() && event.getTarget().endsWith("egg") && shiftDown)
|
||||
{
|
||||
String[] currentCall = client.getWidget(WidgetInfo.BA_COLL_LISTEN_TEXT).getText().split(" ");
|
||||
//log.info("1 " + currentCall[0]);
|
||||
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry correctEgg = null;
|
||||
entries.clear();
|
||||
@@ -607,7 +606,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
entries.add(correctEgg);
|
||||
}
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[0]));
|
||||
}
|
||||
|
||||
if (client.getWidget(WidgetInfo.BA_HEAL_LISTEN_TEXT) != null && inGameBit == 1 && config.osHelp() && event.getTarget().equals("<col=ffff>Healer item machine") && shiftDown)
|
||||
@@ -651,8 +650,8 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
String target = event.getMenuTarget();
|
||||
|
||||
if ((currentCall.equals("Pois. Worms") && (target.contains("Poisoned worms") && target.contains("->") && target.contains("Penance Healer")))
|
||||
|| (currentCall.equals("Pois. Meat") && (target.contains("Poisoned meat") && target.contains("->") && target.contains("Penance Healer")))
|
||||
|| (currentCall.equals("Pois. Tofu") && (target.contains("Poisoned tofu") && target.contains("->") && target.contains("Penance Healer"))))
|
||||
|| (currentCall.equals("Pois. Meat") && (target.contains("Poisoned meat") && target.contains("->") && target.contains("Penance Healer")))
|
||||
|| (currentCall.equals("Pois. Tofu") && (target.contains("Poisoned tofu") && target.contains("->") && target.contains("Penance Healer"))))
|
||||
{
|
||||
foodPressed.put(event.getId(), Instant.now());
|
||||
}
|
||||
@@ -702,7 +701,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
MenuEntry[] entries = client.getMenuEntries();
|
||||
int idx = searchIndex(entries, option, target, strict);
|
||||
if(idx >= 0 && entries[idx] != null)
|
||||
if (idx >= 0 && entries[idx] != null)
|
||||
{
|
||||
entries = ArrayUtils.removeElement(entries, entries[idx]);
|
||||
client.setMenuEntries(entries);
|
||||
@@ -712,11 +711,13 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
private void remove(String[] options, String target, boolean strict)
|
||||
{
|
||||
MenuEntry[] entries = client.getMenuEntries();
|
||||
for(int i = 0; i < options.length; i++)
|
||||
for (String option : options)
|
||||
{
|
||||
int idx = searchIndex(entries, options[i], target, strict);
|
||||
if(idx >= 0 && entries[idx] != null)
|
||||
int idx = searchIndex(entries, option, target, strict);
|
||||
if (idx >= 0 && entries[idx] != null)
|
||||
{
|
||||
entries = ArrayUtils.removeElement(entries, entries[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
client.setMenuEntries(entries);
|
||||
@@ -776,9 +777,9 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
|
||||
// world point of the tile marker
|
||||
WorldPoint worldPoint = new WorldPoint(
|
||||
((regionId >>> 8) << 6) + regionX,
|
||||
((regionId & 0xff) << 6) + regionY,
|
||||
z
|
||||
((regionId >>> 8) << 6) + regionX,
|
||||
((regionId & 0xff) << 6) + regionY,
|
||||
z
|
||||
);
|
||||
|
||||
int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
|
||||
@@ -791,11 +792,11 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
|
||||
int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
|
||||
if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE
|
||||
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE)
|
||||
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE)
|
||||
{
|
||||
WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)),
|
||||
client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)),
|
||||
worldPoint.getPlane());
|
||||
client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)),
|
||||
worldPoint.getPlane());
|
||||
p = rotate(p, rotation);
|
||||
if (p.distanceTo(npc.getWorldLocation()) < 5)
|
||||
{
|
||||
|
||||
@@ -29,9 +29,9 @@ import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class CycleCounter extends Counter
|
||||
class CycleCounter extends Counter
|
||||
{
|
||||
public CycleCounter(BufferedImage img, Plugin plugin, int tick)
|
||||
CycleCounter(BufferedImage img, Plugin plugin, int tick)
|
||||
{
|
||||
super(img, plugin, tick);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.api.Actor;
|
||||
|
||||
|
||||
public class Healer
|
||||
class Healer
|
||||
{
|
||||
|
||||
@Getter
|
||||
@@ -62,9 +62,7 @@ public class Healer
|
||||
@Setter
|
||||
private int secondCallFood;
|
||||
|
||||
|
||||
|
||||
public Healer(NPC npc, int spawnNumber, int wave)
|
||||
Healer(NPC npc, int spawnNumber, int wave)
|
||||
{
|
||||
this.npc = npc;
|
||||
this.wave = wave;
|
||||
@@ -102,7 +100,4 @@ public class Healer
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -25,9 +25,15 @@
|
||||
package net.runelite.client.plugins.blackjack;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Quest;
|
||||
import net.runelite.api.QuestState;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
@@ -36,9 +42,6 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Authors gazivodag longstreet
|
||||
*/
|
||||
@@ -127,6 +130,4 @@ public class BlackjackPlugin extends Plugin {
|
||||
client.setMenuEntries(newEntries);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -31,10 +31,10 @@ public interface ClanManModeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "highlightattacked",
|
||||
name = "Highlight clan targets",
|
||||
description = "Highlights people being attacked by your clan"
|
||||
position = 2,
|
||||
keyName = "highlightattacked",
|
||||
name = "Highlight clan targets",
|
||||
description = "Highlights people being attacked by your clan"
|
||||
)
|
||||
default boolean highlightAttacked()
|
||||
{
|
||||
@@ -42,10 +42,10 @@ public interface ClanManModeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "attackedcolor",
|
||||
name = "Clan target color",
|
||||
description = "Color of players being attacked by clan"
|
||||
position = 3,
|
||||
keyName = "attackedcolor",
|
||||
name = "Clan target color",
|
||||
description = "Color of players being attacked by clan"
|
||||
)
|
||||
default Color getClanAttackableColor()
|
||||
{
|
||||
@@ -86,10 +86,10 @@ public interface ClanManModeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "showtargets",
|
||||
name = "Highlight My Attackers",
|
||||
description = "Shows players interacting with you"
|
||||
position = 7,
|
||||
keyName = "showtargets",
|
||||
name = "Highlight My Attackers",
|
||||
description = "Shows players interacting with you"
|
||||
)
|
||||
default boolean showAttackers()
|
||||
{
|
||||
@@ -97,10 +97,10 @@ public interface ClanManModeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "attackcolor",
|
||||
name = "Attacker Color",
|
||||
description = "Color of attackers"
|
||||
position = 8,
|
||||
keyName = "attackcolor",
|
||||
name = "Attacker Color",
|
||||
description = "Color of attackers"
|
||||
)
|
||||
default Color getAttackerColor()
|
||||
{
|
||||
@@ -108,58 +108,76 @@ public interface ClanManModeConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "showbold",
|
||||
name = "Bold names of clan targets",
|
||||
description = "Turns names of clan targets bold"
|
||||
position = 9,
|
||||
keyName = "showbold",
|
||||
name = "Bold names of clan targets",
|
||||
description = "Turns names of clan targets bold"
|
||||
)
|
||||
default boolean ShowBold() { return false; }
|
||||
default boolean ShowBold()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "hideafter",
|
||||
name = "Hide attackable targets after login",
|
||||
description = "Automatically disables attackable player highlighting after login"
|
||||
position = 10,
|
||||
keyName = "hideafter",
|
||||
name = "Hide attackable targets after login",
|
||||
description = "Automatically disables attackable player highlighting after login"
|
||||
)
|
||||
default boolean hideAttackable() { return false; }
|
||||
default boolean hideAttackable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "hidetime",
|
||||
name = "Ticks to hide",
|
||||
description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)"
|
||||
position = 11,
|
||||
keyName = "hidetime",
|
||||
name = "Ticks to hide",
|
||||
description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)"
|
||||
)
|
||||
default int hideTime() { return 5; }
|
||||
default int hideTime()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "mycblvl",
|
||||
name = "Calc targets on my own combat level",
|
||||
description = "Calculates potential targets based off your own combat lvl instead of clans"
|
||||
position = 12,
|
||||
keyName = "mycblvl",
|
||||
name = "Calc targets on my own combat level",
|
||||
description = "Calculates potential targets based off your own combat lvl instead of clans"
|
||||
)
|
||||
default boolean CalcSelfCB() { return false; }
|
||||
default boolean CalcSelfCB()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "hideatkopt",
|
||||
name = "Hide attack option for clan members",
|
||||
description = "Disables attack option for clan members"
|
||||
position = 13,
|
||||
keyName = "hideatkopt",
|
||||
name = "Hide attack option for clan members",
|
||||
description = "Disables attack option for clan members"
|
||||
)
|
||||
default boolean hideAtkOpt() { return false; }
|
||||
default boolean hideAtkOpt()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "showclanmembers",
|
||||
name = "Persistent Clan Members",
|
||||
description = "Will highlight clan members even when not in clan chat"
|
||||
position = 14,
|
||||
keyName = "showclanmembers",
|
||||
name = "Persistent Clan Members",
|
||||
description = "Will highlight clan members even when not in clan chat"
|
||||
)
|
||||
default boolean PersistentClan() { return false; }
|
||||
default boolean PersistentClan()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
keyName = "clancolor",
|
||||
name = "Clan Member Color",
|
||||
description = "Color of clan members"
|
||||
position = 15,
|
||||
keyName = "clancolor",
|
||||
name = "Clan Member Color",
|
||||
description = "Color of clan members"
|
||||
)
|
||||
default Color getClanMemberColor()
|
||||
{
|
||||
|
||||
@@ -3,10 +3,8 @@ package net.runelite.client.plugins.clanmanmode;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
@@ -21,15 +19,12 @@ public class ClanManModeOverlay extends Overlay
|
||||
{
|
||||
private final ClanManModeService ClanManModeService;
|
||||
private final ClanManModeConfig config;
|
||||
private final ClanManager clanManager;
|
||||
|
||||
@Inject
|
||||
private ClanManModeOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService,
|
||||
ClanManager clanManager)
|
||||
private ClanManModeOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService)
|
||||
{
|
||||
this.config = config;
|
||||
this.ClanManModeService = ClanManModeService;
|
||||
this.clanManager = clanManager;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.runelite.client.plugins.clanmanmode;
|
||||
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -8,12 +7,17 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -26,7 +30,8 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
name = "Clan Man Mode",
|
||||
description = "Assists in clan PVP scenarios",
|
||||
tags = {"highlight", "minimap", "overlay", "players"},
|
||||
type = PluginType.PVP
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class ClanManModePlugin extends Plugin
|
||||
{
|
||||
@@ -123,8 +128,8 @@ public class ClanManModePlugin extends Plugin
|
||||
if (option.equals("attack")) {
|
||||
final Pattern ppattern = Pattern.compile("<col=ffffff>(.+?)<col=");
|
||||
final Matcher pmatch = ppattern.matcher(event.getTarget());
|
||||
pmatch.find();
|
||||
if (pmatch.matches()) {
|
||||
|
||||
if (pmatch.find() && pmatch.matches()) {
|
||||
if (pmatch.group(1) != null) {
|
||||
if (clan.containsKey(pmatch.group(1).replace(" ", " "))) {
|
||||
MenuEntry[] entries = client.getMenuEntries();
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -28,7 +27,7 @@ public class ClanManModeService
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
Map<String, String> interactors = new HashMap<>();
|
||||
private Map<String, String> interactors = new HashMap<>();
|
||||
|
||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||
{
|
||||
@@ -102,7 +101,7 @@ public class ClanManModeService
|
||||
if (config.highlightAttacked()) {
|
||||
if (interactors.containsKey(player.getName())) {
|
||||
String attackername = interactors.get(player.getName());
|
||||
Boolean found = false;
|
||||
boolean found = false;
|
||||
for (Player attacker : client.getPlayers()) {
|
||||
if (attacker == null || attacker.getName() == null) {
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.runelite.client.plugins.climbupclimbdown;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -12,18 +14,16 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Climb Up Climb Down",
|
||||
description = "Hold Shift to Climb up, Ctrl to Climb down",
|
||||
tags = {"climb", "stairs", "ladder", "swap", "key", "input"},
|
||||
type = PluginType.UTILITY
|
||||
name = "Climb Up Climb Down",
|
||||
description = "Hold Shift to Climb up, Ctrl to Climb down",
|
||||
tags = {"climb", "stairs", "ladder", "swap", "key", "input"},
|
||||
type = PluginType.UTILITY
|
||||
)
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class ClimbPlugin extends Plugin {
|
||||
public class ClimbPlugin extends Plugin
|
||||
{
|
||||
|
||||
@Inject
|
||||
Client client;
|
||||
@@ -37,32 +37,45 @@ public class ClimbPlugin extends Plugin {
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean isHoldingShift;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean isHoldingCtrl;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
enableCustomization();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
disableCustomization();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) {
|
||||
try {
|
||||
if (menuEntryAdded.getOption().equalsIgnoreCase("climb")) {
|
||||
if (isHoldingCtrl ^ isHoldingShift) {
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (menuEntryAdded.getOption().equalsIgnoreCase("climb"))
|
||||
{
|
||||
if (isHoldingCtrl ^ isHoldingShift)
|
||||
{
|
||||
if (isHoldingShift)
|
||||
{
|
||||
stripExceptFor("climb-up");
|
||||
}
|
||||
if (isHoldingCtrl)
|
||||
{
|
||||
stripExceptFor("climb-down");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("Uh oh!", e);
|
||||
}
|
||||
}
|
||||
@@ -78,16 +91,21 @@ public class ClimbPlugin extends Plugin {
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
|
||||
private void stripExceptFor(String option) {
|
||||
private void stripExceptFor(String option)
|
||||
{
|
||||
MenuEntry[] newEntries = new MenuEntry[1];
|
||||
|
||||
for (MenuEntry entry : client.getMenuEntries())
|
||||
{
|
||||
if (entry.getOption().equalsIgnoreCase(option))
|
||||
{
|
||||
newEntries[0] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
if (newEntries[0] != null)
|
||||
{
|
||||
client.setMenuEntries(newEntries);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +1,60 @@
|
||||
package net.runelite.client.plugins.climbupclimbdown;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@Slf4j
|
||||
public class ShiftCtrlInputListener implements KeyListener {
|
||||
|
||||
@Inject
|
||||
Client client;
|
||||
|
||||
public class ShiftCtrlInputListener implements KeyListener
|
||||
{
|
||||
@Inject
|
||||
ClimbPlugin plugin;
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
switch (e.getKeyCode()) {
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
switch (e.getKeyCode())
|
||||
{
|
||||
case KeyEvent.VK_SHIFT:
|
||||
if (plugin.isHoldingShift()) return;
|
||||
if (plugin.isHoldingShift())
|
||||
{
|
||||
return;
|
||||
}
|
||||
plugin.setHoldingShift(true);
|
||||
break;
|
||||
case KeyEvent.VK_CONTROL:
|
||||
if (plugin.isHoldingCtrl()) return;
|
||||
if (plugin.isHoldingCtrl())
|
||||
{
|
||||
return;
|
||||
}
|
||||
plugin.setHoldingCtrl(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
switch (e.getKeyCode()) {
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
switch (e.getKeyCode())
|
||||
{
|
||||
case KeyEvent.VK_SHIFT:
|
||||
if (!plugin.isHoldingShift()) return;
|
||||
if (!plugin.isHoldingShift())
|
||||
{
|
||||
return;
|
||||
}
|
||||
plugin.setHoldingShift(false);
|
||||
break;
|
||||
case KeyEvent.VK_CONTROL:
|
||||
if (!plugin.isHoldingCtrl()) return;
|
||||
if (!plugin.isHoldingCtrl())
|
||||
{
|
||||
return;
|
||||
}
|
||||
plugin.setHoldingCtrl(false);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -206,82 +206,75 @@ public class ConfigPanel extends PluginPanel
|
||||
List<PluginListItem> externalPlugins = new ArrayList<>();
|
||||
// populate pluginList with all external Plugins
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type()==PluginType.EXTERNAL)
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.EXTERNAL))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
System.out.println("Started "+listItem.getName());
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
externalPlugins.add(listItem);
|
||||
});
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
externalPlugins.add(listItem);
|
||||
});
|
||||
|
||||
externalPlugins.sort(Comparator.comparing(PluginListItem::getName));
|
||||
for (PluginListItem plugin : externalPlugins)
|
||||
pluginList.add(plugin);
|
||||
pluginList.addAll(externalPlugins);
|
||||
|
||||
List<PluginListItem> pvmPlugins = new ArrayList<>();
|
||||
// populate pluginList with all PVM Plugins
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PVM))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
System.out.println("Started "+listItem.getName());
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
pvmPlugins.add(listItem);
|
||||
});
|
||||
// populate pluginList with all non-hidden plugins
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PVM))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
pvmPlugins.add(listItem);
|
||||
});
|
||||
|
||||
pvmPlugins.sort(Comparator.comparing(PluginListItem::getName));
|
||||
for (PluginListItem plugin : pvmPlugins)
|
||||
pluginList.add(plugin);
|
||||
pluginList.addAll(pvmPlugins);
|
||||
|
||||
List<PluginListItem> pvpPlugins = new ArrayList<>();
|
||||
// populate pluginList with all PVP Plugins
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PVP))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PVP))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
System.out.println("Started "+listItem.getName());
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
pvpPlugins.add(listItem);
|
||||
});
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
pvpPlugins.add(listItem);
|
||||
});
|
||||
|
||||
pvpPlugins.sort(Comparator.comparing(PluginListItem::getName));
|
||||
for (PluginListItem plugin : pvpPlugins)
|
||||
pluginList.add(plugin);
|
||||
pluginList.addAll(pvpPlugins);
|
||||
|
||||
List<PluginListItem> utilPlugins = new ArrayList<>();
|
||||
// populate pluginList with all utility Plugins
|
||||
// populate pluginList with all PVP Plugins
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.UTILITY))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.UTILITY))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
System.out.println("Started "+listItem.getName());
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
utilPlugins.add(listItem);
|
||||
});
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
|
||||
utilPlugins.add(listItem);
|
||||
});
|
||||
|
||||
utilPlugins.sort(Comparator.comparing(PluginListItem::getName));
|
||||
for (PluginListItem plugin : utilPlugins)
|
||||
pluginList.add(plugin);
|
||||
pluginList.addAll(utilPlugins);
|
||||
|
||||
// populate pluginList with all vanilla RL plugins
|
||||
List<PluginListItem> vanillaPlugins = new ArrayList<>();
|
||||
@@ -312,22 +305,20 @@ public class ConfigPanel extends PluginPanel
|
||||
vanillaPlugins.add(chatColor);
|
||||
|
||||
vanillaPlugins.sort(Comparator.comparing(PluginListItem::getName));
|
||||
for (PluginListItem plugin : vanillaPlugins)
|
||||
pluginList.add(plugin);
|
||||
pluginList.addAll(vanillaPlugins);
|
||||
|
||||
// Add plugin sorter to bottom
|
||||
pluginManager.getPlugins().stream()
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PLUGIN_ORGANIZER))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PLUGIN_ORGANIZER))
|
||||
.forEach(plugin ->
|
||||
{
|
||||
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
final Config config = pluginManager.getPluginConfigProxy(plugin);
|
||||
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
|
||||
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
System.out.println("Started "+listItem.getName());
|
||||
pluginList.add(listItem);
|
||||
});
|
||||
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
|
||||
pluginList.add(listItem);
|
||||
});
|
||||
}
|
||||
|
||||
void refreshPluginList()
|
||||
|
||||
@@ -24,41 +24,43 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.equipmentinspector;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.plugins.grounditems.config.ItemHighlightMode;
|
||||
import net.runelite.client.plugins.grounditems.config.MenuHighlightMode;
|
||||
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
|
||||
|
||||
@ConfigGroup("grounditems")
|
||||
public interface EquipmentInspectorConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "ShowValue",
|
||||
name = "Show the total value of the items",
|
||||
description = "shows the total value of the items",
|
||||
position = 1
|
||||
)
|
||||
default boolean ShowValue()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "protecteditems",
|
||||
name = "# of protected items",
|
||||
description = "Limit 4",
|
||||
position = 2
|
||||
)
|
||||
default int protecteditems()
|
||||
{ return 1; }
|
||||
@ConfigItem(
|
||||
keyName = "ExactValue",
|
||||
name = "Show exact value",
|
||||
description = "shows the excact gp value",
|
||||
position = 3
|
||||
)
|
||||
default boolean ExactValue()
|
||||
{ return false; }
|
||||
@ConfigItem(
|
||||
keyName = "ShowValue",
|
||||
name = "Show the total value of the items",
|
||||
description = "shows the total value of the items",
|
||||
position = 1
|
||||
)
|
||||
default boolean ShowValue()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "protecteditems",
|
||||
name = "# of protected items",
|
||||
description = "Limit 4",
|
||||
position = 2
|
||||
)
|
||||
default int protecteditems()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ExactValue",
|
||||
name = "Show exact value",
|
||||
description = "shows the excact gp value",
|
||||
position = 3
|
||||
)
|
||||
default boolean ExactValue()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,21 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.equipmentinspector;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.kit.KitType;
|
||||
@@ -32,15 +47,6 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class EquipmentInspectorPanel extends PluginPanel
|
||||
@@ -71,27 +77,27 @@ public class EquipmentInspectorPanel extends PluginPanel
|
||||
header = new JPanel();
|
||||
header.setLayout(new BorderLayout());
|
||||
header.setBorder(new CompoundBorder(
|
||||
BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(58, 58, 58)),
|
||||
BorderFactory.createEmptyBorder(0, 0, 10, 0)));
|
||||
BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(58, 58, 58)),
|
||||
BorderFactory.createEmptyBorder(0, 0, 10, 0)));
|
||||
|
||||
nameLabel = new JLabel(NO_PLAYER_SELECTED);
|
||||
nameLabel.setForeground(Color.WHITE);
|
||||
header.add(nameLabel, BorderLayout.CENTER);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup()
|
||||
.addComponent(equipmentPanels)
|
||||
.addComponent(header)
|
||||
.addComponent(equipmentPanels)
|
||||
.addComponent(header)
|
||||
);
|
||||
layout.setVerticalGroup(layout.createSequentialGroup()
|
||||
.addComponent(header)
|
||||
.addGap(10)
|
||||
.addComponent(equipmentPanels)
|
||||
.addComponent(header)
|
||||
.addGap(10)
|
||||
.addComponent(equipmentPanels)
|
||||
);
|
||||
update(new HashMap<>(), "");
|
||||
}
|
||||
|
||||
public void update(Map<KitType, ItemComposition> playerEquipment, String playerName)
|
||||
{
|
||||
if (playerName.isEmpty() || playerName == null)
|
||||
if (playerName.isEmpty())
|
||||
{
|
||||
nameLabel.setText(NO_PLAYER_SELECTED);
|
||||
}
|
||||
@@ -100,18 +106,18 @@ public class EquipmentInspectorPanel extends PluginPanel
|
||||
nameLabel.setText("Player: " + playerName);
|
||||
}
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
equipmentPanels.removeAll();
|
||||
playerEquipment.forEach((kitType, itemComposition) ->
|
||||
{
|
||||
equipmentPanels.removeAll();
|
||||
playerEquipment.forEach((kitType, itemComposition) ->
|
||||
{
|
||||
AsyncBufferedImage itemImage = itemManager.getImage(itemComposition.getId());
|
||||
equipmentPanels.add(new ItemPanel(itemComposition, kitType, itemImage), c);
|
||||
c.gridy++;
|
||||
AsyncBufferedImage itemImage = itemManager.getImage(itemComposition.getId());
|
||||
equipmentPanels.add(new ItemPanel(itemComposition, kitType, itemImage), c);
|
||||
c.gridy++;
|
||||
|
||||
});
|
||||
header.revalidate();
|
||||
header.repaint();
|
||||
}
|
||||
});
|
||||
header.revalidate();
|
||||
header.repaint();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,18 @@ package net.runelite.client.plugins.equipmentinspector;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.SwingUtilities;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
@@ -49,208 +61,226 @@ import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Equipment Inspector",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVP
|
||||
name = "Equipment Inspector",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVP
|
||||
)
|
||||
|
||||
@Slf4j
|
||||
|
||||
public class EquipmentInspectorPlugin extends Plugin {
|
||||
public class EquipmentInspectorPlugin extends Plugin
|
||||
{
|
||||
private static final String INSPECT_EQUIPMENT = "Gear";
|
||||
|
||||
private static final String INSPECT_EQUIPMENT = "Gear";
|
||||
private static final String KICK_OPTION = "Kick";
|
||||
@Inject
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
private Client client;
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
@Inject
|
||||
private EquipmentInspectorConfig config;
|
||||
|
||||
@Inject
|
||||
private EquipmentInspectorConfig config;
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
@Inject
|
||||
private ClientToolbar pluginToolbar;
|
||||
private NavigationButton navButton;
|
||||
private EquipmentInspectorPanel equipmentInspectorPanel;
|
||||
private int TotalPrice = 0;
|
||||
private int Prot1 = 0;
|
||||
private int Prot2 = 0;
|
||||
private int Prot3 = 0;
|
||||
private int Prot4 = 0;
|
||||
|
||||
@Inject
|
||||
private ClientToolbar pluginToolbar;
|
||||
private NavigationButton navButton;
|
||||
private EquipmentInspectorPanel equipmentInspectorPanel;
|
||||
private int TotalPrice = 0;
|
||||
private int Prot1 = 0;
|
||||
private int Prot2 = 0;
|
||||
private int Prot3 = 0;
|
||||
private int Prot4 = 0;
|
||||
@Provides
|
||||
EquipmentInspectorConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(EquipmentInspectorConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
EquipmentInspectorConfig provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(EquipmentInspectorConfig.class);
|
||||
}
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
|
||||
if (client != null)
|
||||
{
|
||||
menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT);
|
||||
}
|
||||
|
||||
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
|
||||
if (client != null) {
|
||||
menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT);
|
||||
}
|
||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "normal.png");
|
||||
|
||||
//synchronized (ImageIO.class)
|
||||
//{
|
||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "normal.png");
|
||||
//}
|
||||
|
||||
navButton = NavigationButton.builder()
|
||||
.tooltip("Equipment Inspector")
|
||||
.icon(icon)
|
||||
.priority(5)
|
||||
.panel(equipmentInspectorPanel)
|
||||
.build();
|
||||
navButton = NavigationButton.builder()
|
||||
.tooltip("Equipment Inspector")
|
||||
.icon(icon)
|
||||
.priority(5)
|
||||
.panel(equipmentInspectorPanel)
|
||||
.build();
|
||||
|
||||
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
pluginToolbar.addNavigation(navButton);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
|
||||
}
|
||||
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) {
|
||||
if (event.getMenuOption().equals(INSPECT_EQUIPMENT)) {
|
||||
@Subscribe
|
||||
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuOption().equals(INSPECT_EQUIPMENT))
|
||||
{
|
||||
|
||||
|
||||
executor.execute(() ->
|
||||
{
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
{
|
||||
if (!navButton.isSelected()) {
|
||||
navButton.getOnSelect().run();
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException | InvocationTargetException e) {
|
||||
executor.execute(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
SwingUtilities.invokeAndWait(() ->
|
||||
{
|
||||
if (!navButton.isSelected())
|
||||
{
|
||||
navButton.getOnSelect().run();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (InterruptedException | InvocationTargetException e)
|
||||
{
|
||||
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
}
|
||||
String playerName = Text.removeTags(event.getMenuTarget());
|
||||
// The player menu uses a non-breaking space in the player name, we need to replace this to compare
|
||||
// against the playerName in the player cache.
|
||||
String finalPlayerName = playerName.replace('\u00A0', ' ');
|
||||
System.out.println(finalPlayerName);
|
||||
List<Player> players = client.getPlayers();
|
||||
Optional<Player> targetPlayer = players.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(p -> p.getName().equals(finalPlayerName)).findFirst();
|
||||
}
|
||||
String playerName = Text.removeTags(event.getMenuTarget());
|
||||
// The player menu uses a non-breaking space in the player name, we need to replace this to compare
|
||||
// against the playerName in the player cache.
|
||||
String finalPlayerName = playerName.replace('\u00A0', ' ');
|
||||
System.out.println(finalPlayerName);
|
||||
List<Player> players = client.getPlayers();
|
||||
Optional<Player> targetPlayer = players.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(p -> p.getName().equals(finalPlayerName)).findFirst();
|
||||
|
||||
if (targetPlayer.isPresent()) {
|
||||
TotalPrice = 0;
|
||||
Prot1 = 0;
|
||||
Prot2 = 0;
|
||||
Prot3 = 0;
|
||||
Prot4 = 0;
|
||||
Player p = targetPlayer.get();
|
||||
Map<KitType, ItemComposition> playerEquipment = new HashMap<>();
|
||||
if (targetPlayer.isPresent())
|
||||
{
|
||||
TotalPrice = 0;
|
||||
Prot1 = 0;
|
||||
Prot2 = 0;
|
||||
Prot3 = 0;
|
||||
Prot4 = 0;
|
||||
Player p = targetPlayer.get();
|
||||
Map<KitType, ItemComposition> playerEquipment = new HashMap<>();
|
||||
|
||||
for (KitType kitType : KitType.values()) {
|
||||
if (kitType == KitType.RING) continue; //prevents the equipment inspector from breaking
|
||||
if (kitType == KitType.AMMUNITION) continue;
|
||||
for (KitType kitType : KitType.values())
|
||||
{
|
||||
if (kitType == KitType.RING)
|
||||
{
|
||||
continue; //prevents the equipment inspector from breaking
|
||||
}
|
||||
if (kitType == KitType.AMMUNITION)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int itemId = p.getPlayerComposition().getEquipmentId(kitType);
|
||||
if (itemId != -1) {
|
||||
ItemComposition itemComposition = client.getItemDefinition(itemId);
|
||||
playerEquipment.put(kitType, itemComposition);
|
||||
int ItemPrice = itemManager.getItemPrice(itemId);
|
||||
TotalPrice += ItemPrice;
|
||||
if (ItemPrice > Prot1) {
|
||||
Prot4 = Prot3;
|
||||
Prot3 = Prot2;
|
||||
Prot2 = Prot1;
|
||||
int itemId = p.getPlayerComposition().getEquipmentId(kitType);
|
||||
if (itemId != -1)
|
||||
{
|
||||
ItemComposition itemComposition = client.getItemDefinition(itemId);
|
||||
playerEquipment.put(kitType, itemComposition);
|
||||
int ItemPrice = itemManager.getItemPrice(itemId);
|
||||
TotalPrice += ItemPrice;
|
||||
if (ItemPrice > Prot1)
|
||||
{
|
||||
Prot4 = Prot3;
|
||||
Prot3 = Prot2;
|
||||
Prot2 = Prot1;
|
||||
|
||||
Prot1 = ItemPrice;
|
||||
} else if (ItemPrice > Prot2) {
|
||||
Prot4 = Prot3;
|
||||
Prot3 = Prot2;
|
||||
Prot2 = ItemPrice;
|
||||
} else if (ItemPrice > Prot3) {
|
||||
Prot4 = Prot3;
|
||||
Prot3 = ItemPrice;
|
||||
} else if (ItemPrice > Prot4) {
|
||||
Prot4 = ItemPrice;
|
||||
}
|
||||
}
|
||||
}
|
||||
int IgnoredItems = config.protecteditems();
|
||||
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3) {
|
||||
IgnoredItems = 4;
|
||||
Prot1 = ItemPrice;
|
||||
}
|
||||
else if (ItemPrice > Prot2)
|
||||
{
|
||||
Prot4 = Prot3;
|
||||
Prot3 = Prot2;
|
||||
Prot2 = ItemPrice;
|
||||
}
|
||||
else if (ItemPrice > Prot3)
|
||||
{
|
||||
Prot4 = Prot3;
|
||||
Prot3 = ItemPrice;
|
||||
}
|
||||
else if (ItemPrice > Prot4)
|
||||
{
|
||||
Prot4 = ItemPrice;
|
||||
}
|
||||
}
|
||||
}
|
||||
int IgnoredItems = config.protecteditems();
|
||||
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3)
|
||||
{
|
||||
IgnoredItems = 4;
|
||||
|
||||
}
|
||||
if (config.ShowValue()) {
|
||||
switch (IgnoredItems) {
|
||||
case 1:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
break;
|
||||
case 2:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
}
|
||||
if (config.ShowValue())
|
||||
{
|
||||
switch (IgnoredItems)
|
||||
{
|
||||
case 1:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
break;
|
||||
case 2:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
TotalPrice = TotalPrice - Prot3;
|
||||
break;
|
||||
case 4:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
TotalPrice = TotalPrice - Prot3;
|
||||
TotalPrice = TotalPrice - Prot4;
|
||||
break;
|
||||
}
|
||||
String StringPrice = "";
|
||||
if (!config.ExactValue()) {
|
||||
TotalPrice = TotalPrice / 1000;
|
||||
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
|
||||
StringPrice = StringPrice + 'K';
|
||||
}
|
||||
if (config.ExactValue()) {
|
||||
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
|
||||
}
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
.runeLiteFormattedMessage(new ChatMessageBuilder()
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append("Risked Value: ")
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(StringPrice)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
equipmentInspectorPanel.update(playerEquipment, playerName);
|
||||
break;
|
||||
case 3:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
TotalPrice = TotalPrice - Prot3;
|
||||
break;
|
||||
case 4:
|
||||
TotalPrice = TotalPrice - Prot1;
|
||||
TotalPrice = TotalPrice - Prot2;
|
||||
TotalPrice = TotalPrice - Prot3;
|
||||
TotalPrice = TotalPrice - Prot4;
|
||||
break;
|
||||
}
|
||||
String StringPrice = "";
|
||||
if (!config.ExactValue())
|
||||
{
|
||||
TotalPrice = TotalPrice / 1000;
|
||||
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
|
||||
StringPrice = StringPrice + 'K';
|
||||
}
|
||||
if (config.ExactValue())
|
||||
{
|
||||
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
|
||||
}
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
.runeLiteFormattedMessage(new ChatMessageBuilder()
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append("Risked Value: ")
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(StringPrice)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
equipmentInspectorPanel.update(playerEquipment, playerName);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.equipmentinspector;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.game.AsyncBufferedImage;
|
||||
@@ -31,12 +35,8 @@ import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
class ItemPanel extends JPanel
|
||||
{
|
||||
|
||||
ItemPanel(ItemComposition item, KitType kitType, AsyncBufferedImage icon)
|
||||
{
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
name = "Fight Cave",
|
||||
description = "Displays current and upcoming wave monsters in the Fight Caves",
|
||||
tags = {"bosses", "combat", "minigame", "overlay", "pve", "pvm", "jad", "fire", "cape", "wave"},
|
||||
type = PluginType.PVM,
|
||||
enabledByDefault = false
|
||||
type = PluginType.PVM
|
||||
)
|
||||
|
||||
public class FightCavePlugin extends Plugin
|
||||
|
||||
@@ -29,180 +29,198 @@ import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("flexo")
|
||||
public interface FlexoConfig extends Config {
|
||||
public interface FlexoConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "overlayEnabled",
|
||||
name = "Overlay Enabled",
|
||||
description = "Shows clicking area and points etc."
|
||||
)
|
||||
default boolean overlayEnabled() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "overlayEnabled",
|
||||
name = "Overlay Enabled",
|
||||
description = "Shows clicking area and points etc."
|
||||
)
|
||||
default boolean overlayEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "minDelayAmount",
|
||||
name = "Min Delay",
|
||||
description = "Minimum delay that is applied to every action at the end (ms)"
|
||||
)
|
||||
default int minDelayAmt() {
|
||||
return 45;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "minDelayAmount",
|
||||
name = "Min Delay",
|
||||
description = "Minimum delay that is applied to every action at the end (ms)"
|
||||
)
|
||||
default int minDelayAmt()
|
||||
{
|
||||
return 45;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "reactionTime",
|
||||
name = "Reaction Time",
|
||||
description = "The base time between actions (ms)"
|
||||
)
|
||||
default int getReactionTimeVariation() {
|
||||
return 80;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "reactionTime",
|
||||
name = "Reaction Time",
|
||||
description = "The base time between actions (ms)"
|
||||
)
|
||||
default int getReactionTimeVariation()
|
||||
{
|
||||
return 80;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "mouseDragSpeed",
|
||||
name = "Mouse drag speed",
|
||||
description = "The speed at which steps are executed. Keep at 49? cuz jagex mouse recorder?"
|
||||
)
|
||||
default int getMouseDragSpeed() {
|
||||
return 49;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "mouseDragSpeed",
|
||||
name = "Mouse drag speed",
|
||||
description = "The speed at which steps are executed. Keep at 49? cuz jagex mouse recorder?"
|
||||
)
|
||||
default int getMouseDragSpeed()
|
||||
{
|
||||
return 49;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "overshoots",
|
||||
name = "Overshoots",
|
||||
description = "Higher number = more overshoots"
|
||||
)
|
||||
default int getOvershoots() {
|
||||
return 4;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "overshoots",
|
||||
name = "Overshoots",
|
||||
description = "Higher number = more overshoots"
|
||||
)
|
||||
default int getOvershoots()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "variatingFlow",
|
||||
name = "Flow - Variating",
|
||||
description = ""
|
||||
)
|
||||
default boolean getVariatingFlow() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "variatingFlow",
|
||||
name = "Flow - Variating",
|
||||
description = ""
|
||||
)
|
||||
default boolean getVariatingFlow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "slowStartupFlow",
|
||||
name = "Flow - Slow startup",
|
||||
description = ""
|
||||
)
|
||||
default boolean getSlowStartupFlow() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "slowStartupFlow",
|
||||
name = "Flow - Slow startup",
|
||||
description = ""
|
||||
)
|
||||
default boolean getSlowStartupFlow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "slowStartup2Flow",
|
||||
name = "Flow - Slow startup 2",
|
||||
description = ""
|
||||
)
|
||||
default boolean getSlowStartup2Flow() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "slowStartup2Flow",
|
||||
name = "Flow - Slow startup 2",
|
||||
description = ""
|
||||
)
|
||||
default boolean getSlowStartup2Flow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "jaggedFlow",
|
||||
name = "Flow - Jagged",
|
||||
description = ""
|
||||
)
|
||||
default boolean getJaggedFlow() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "jaggedFlow",
|
||||
name = "Flow - Jagged",
|
||||
description = ""
|
||||
)
|
||||
default boolean getJaggedFlow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "interruptedFlow",
|
||||
name = "Flow - Interrupted",
|
||||
description = ""
|
||||
)
|
||||
default boolean getInterruptedFlow() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "interruptedFlow",
|
||||
name = "Flow - Interrupted",
|
||||
description = ""
|
||||
)
|
||||
default boolean getInterruptedFlow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "interruptedFlow2",
|
||||
name = "Flow - Interrupted 2",
|
||||
description = ""
|
||||
)
|
||||
default boolean getInterruptedFlow2() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "interruptedFlow2",
|
||||
name = "Flow - Interrupted 2",
|
||||
description = ""
|
||||
)
|
||||
default boolean getInterruptedFlow2()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "stoppingFlow",
|
||||
name = "Flow - Stopping",
|
||||
description = ""
|
||||
)
|
||||
default boolean getStoppingFlow() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "stoppingFlow",
|
||||
name = "Flow - Stopping",
|
||||
description = ""
|
||||
)
|
||||
default boolean getStoppingFlow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "deviationSlopeDivider",
|
||||
name = "Deviation slope divider",
|
||||
description = ""
|
||||
)
|
||||
default int getDeviationSlope() {
|
||||
return 10;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "deviationSlopeDivider",
|
||||
name = "Deviation slope divider",
|
||||
description = ""
|
||||
)
|
||||
default int getDeviationSlope()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "noisinessDivider",
|
||||
name = "Noisiness divider",
|
||||
description = ""
|
||||
)
|
||||
default String getNoisinessDivider() {
|
||||
return "2.0D";
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "noisinessDivider",
|
||||
name = "Noisiness divider",
|
||||
description = ""
|
||||
)
|
||||
default String getNoisinessDivider()
|
||||
{
|
||||
return "2.0D";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "debugNPCs",
|
||||
name = "Debug NPCs",
|
||||
description = "Draws clickArea and clickPoints across all visible npcs"
|
||||
)
|
||||
default boolean getDebugNPCs() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "debugNPCs",
|
||||
name = "Debug NPCs",
|
||||
description = "Draws clickArea and clickPoints across all visible npcs"
|
||||
)
|
||||
default boolean getDebugNPCs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
keyName = "debugPlayers",
|
||||
name = "Debug Players",
|
||||
description = "Draws clickArea and clickPoints across all visible players"
|
||||
)
|
||||
default boolean getDebugPlayers() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
keyName = "debugPlayers",
|
||||
name = "Debug Players",
|
||||
description = "Draws clickArea and clickPoints across all visible players"
|
||||
)
|
||||
default boolean getDebugPlayers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
keyName = "debugGroundItems",
|
||||
name = "Debug Ground Items",
|
||||
description = "Draws clickArea and clickPoints across all visible ground items"
|
||||
)
|
||||
default boolean getDebugGroundItems() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
keyName = "debugGroundItems",
|
||||
name = "Debug Ground Items",
|
||||
description = "Draws clickArea and clickPoints across all visible ground items"
|
||||
)
|
||||
default boolean getDebugGroundItems()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,66 +27,74 @@
|
||||
|
||||
package net.runelite.client.plugins.flexo;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.util.ArrayList;
|
||||
public class FlexoOverlay extends Overlay
|
||||
{
|
||||
private static Rectangle clickArea;
|
||||
|
||||
public class FlexoOverlay extends Overlay {
|
||||
ArrayList<Rectangle> clickAreas = new ArrayList<>();
|
||||
ArrayList<Point> clickPoints = new ArrayList<>();
|
||||
|
||||
public static Rectangle clickArea;
|
||||
public ArrayList<Rectangle> clickAreas = new ArrayList<>();
|
||||
public ArrayList<Point> clickPoints = new ArrayList<>();
|
||||
@Inject
|
||||
private FlexoConfig config;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private FlexoPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private FlexoConfig config;
|
||||
|
||||
@Inject
|
||||
public FlexoOverlay(@Nullable Client client, FlexoPlugin plugin, FlexoConfig config) {
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
@Inject
|
||||
public FlexoOverlay(FlexoConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (config.getDebugNPCs() || config.getDebugGroundItems() || config.getDebugPlayers()) {
|
||||
if (clickArea!=null)
|
||||
graphics.draw(clickArea);
|
||||
if (clickAreas!=null) {
|
||||
for (Rectangle clickArea : clickAreas) {
|
||||
if (clickArea!=null)
|
||||
graphics.draw(clickArea);
|
||||
}
|
||||
}
|
||||
if (clickPoints!=null) {
|
||||
for (Point p : clickPoints) {
|
||||
if (p!=null) {
|
||||
graphics.setColor(Color.MAGENTA);
|
||||
graphics.draw(new Line2D.Double(p.x, p.y, p.x, p.y));
|
||||
graphics.draw(new Line2D.Double(p.x-1, p.y-1, p.x-1, p.y-1));
|
||||
graphics.draw(new Line2D.Double(p.x+1, p.y+1, p.x+1, p.y+1));
|
||||
graphics.draw(new Line2D.Double(p.x-1, p.y+1, p.x-1, p.y+1));
|
||||
graphics.draw(new Line2D.Double(p.x+1, p.y-1, p.x+1, p.y-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.getDebugNPCs() || config.getDebugGroundItems() || config.getDebugPlayers())
|
||||
{
|
||||
if (clickArea != null)
|
||||
{
|
||||
graphics.draw(clickArea);
|
||||
}
|
||||
if (clickAreas != null)
|
||||
{
|
||||
for (Rectangle clickArea : clickAreas)
|
||||
{
|
||||
if (clickArea != null)
|
||||
{
|
||||
graphics.draw(clickArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (clickPoints != null)
|
||||
{
|
||||
for (Point p : clickPoints)
|
||||
{
|
||||
if (p != null)
|
||||
{
|
||||
graphics.setColor(Color.MAGENTA);
|
||||
graphics.draw(new Line2D.Double(p.x, p.y, p.x, p.y));
|
||||
graphics.draw(new Line2D.Double(p.x - 1, p.y - 1, p.x - 1, p.y - 1));
|
||||
graphics.draw(new Line2D.Double(p.x + 1, p.y + 1, p.x + 1, p.y + 1));
|
||||
graphics.draw(new Line2D.Double(p.x - 1, p.y + 1, p.x - 1, p.y + 1));
|
||||
graphics.draw(new Line2D.Double(p.x + 1, p.y - 1, p.x + 1, p.y - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ import com.github.joonasvali.naturalmouse.support.Flow;
|
||||
import com.github.joonasvali.naturalmouse.support.SinusoidalDeviationProvider;
|
||||
import com.github.joonasvali.naturalmouse.util.FlowTemplates;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -42,7 +47,6 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.events.BeforeRender;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.flexo.Flexo;
|
||||
@@ -56,178 +60,227 @@ import net.runelite.client.plugins.stretchedmode.StretchedModeConfig;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Flexo Config",
|
||||
description = "Customizes the flexo api",
|
||||
tags = {"flexo", "null"},
|
||||
type = PluginType.UTILITY
|
||||
name = "Flexo Config",
|
||||
description = "Customizes the flexo api",
|
||||
tags = {"flexo", "null"},
|
||||
type = PluginType.UTILITY
|
||||
)
|
||||
public class FlexoPlugin extends Plugin {
|
||||
public class FlexoPlugin extends Plugin
|
||||
{
|
||||
private Flexo flexo;
|
||||
|
||||
private Flexo flexo;
|
||||
{
|
||||
try
|
||||
{
|
||||
flexo = new Flexo();
|
||||
}
|
||||
catch (AWTException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
try {
|
||||
flexo = new Flexo();
|
||||
} catch (AWTException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientUI clientUI;
|
||||
@Inject
|
||||
private ClientUI clientUI;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private FlexoOverlay overlay;
|
||||
@Inject
|
||||
private FlexoOverlay overlay;
|
||||
|
||||
@Provides
|
||||
FlexoConfig getConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(FlexoConfig.class);
|
||||
}
|
||||
@Provides
|
||||
FlexoConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(FlexoConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event) {
|
||||
if (event.getKey().compareTo("overlayEnabled")==0) {
|
||||
if (getConfig(configManager).overlayEnabled()) {
|
||||
overlayManager.add(overlay);
|
||||
} else {
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
updateMouseMotionFactory();
|
||||
}
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getKey().compareTo("overlayEnabled") == 0)
|
||||
{
|
||||
if (getConfig(configManager).overlayEnabled())
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
updateMouseMotionFactory();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onBeforeRender(BeforeRender event) {
|
||||
if (Flexo.client==null)
|
||||
Flexo.client = client;
|
||||
if (Flexo.clientUI==null)
|
||||
Flexo.clientUI = clientUI;
|
||||
overlay.clickAreas = new ArrayList<>();
|
||||
overlay.clickPoints = new ArrayList<>();
|
||||
if (getConfig(configManager).getDebugNPCs()) {
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
if (flexo != null)
|
||||
for (NPC npc : client.getNpcs()) {
|
||||
if (npc != null)
|
||||
if (npc.getConvexHull() != null) {
|
||||
Rectangle r = FlexoMouse.getClickArea(npc.getConvexHull().getBounds());
|
||||
overlay.clickAreas.add(r);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Subscribe
|
||||
public void onBeforeRender(BeforeRender event)
|
||||
{
|
||||
if (Flexo.client == null)
|
||||
{
|
||||
Flexo.client = client;
|
||||
}
|
||||
if (Flexo.clientUI == null)
|
||||
{
|
||||
Flexo.clientUI = clientUI;
|
||||
}
|
||||
overlay.clickAreas = new ArrayList<>();
|
||||
overlay.clickPoints = new ArrayList<>();
|
||||
if (getConfig(configManager).getDebugNPCs())
|
||||
{
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
if (flexo != null)
|
||||
{
|
||||
for (NPC npc : client.getNpcs())
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
if (npc.getConvexHull() != null)
|
||||
{
|
||||
Rectangle r = FlexoMouse.getClickArea(npc.getConvexHull().getBounds());
|
||||
overlay.clickAreas.add(r);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getDebugPlayers()) {
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
if (flexo != null)
|
||||
for (Player player : client.getPlayers()) {
|
||||
if (player != null)
|
||||
if (player.getConvexHull() != null) {
|
||||
Rectangle r = FlexoMouse.getClickArea(player.getConvexHull().getBounds());
|
||||
overlay.clickAreas.add(r);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getConfig(configManager).getDebugPlayers())
|
||||
{
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
if (flexo != null)
|
||||
{
|
||||
for (Player player : client.getPlayers())
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
if (player.getConvexHull() != null)
|
||||
{
|
||||
Rectangle r = FlexoMouse.getClickArea(player.getConvexHull().getBounds());
|
||||
overlay.clickAreas.add(r);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Could still use some improvement
|
||||
if (getConfig(configManager).getDebugGroundItems()) {
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
if (flexo != null)
|
||||
if (GroundItemsPlugin.getCollectedGroundItems()!=null)
|
||||
for (GroundItem gi : GroundItemsPlugin.getCollectedGroundItems().values()) {
|
||||
if (gi != null)
|
||||
if (Perspective.getCanvasTilePoly(client, LocalPoint.fromWorld(client, gi.getLocation()))!=null) {
|
||||
Rectangle r1 = FlexoMouse.getClickArea(Perspective.getCanvasTilePoly(client, LocalPoint.fromWorld(client, gi.getLocation())).getBounds());
|
||||
Rectangle r2 = FlexoMouse.getClickArea(r1);
|
||||
Rectangle r3 = FlexoMouse.getClickArea(r2);
|
||||
overlay.clickAreas.add(r3);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r3);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Could still use some improvement
|
||||
if (getConfig(configManager).getDebugGroundItems())
|
||||
{
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event) {
|
||||
if (flexo != null)
|
||||
{
|
||||
if (GroundItemsPlugin.getCollectedGroundItems() != null)
|
||||
{
|
||||
for (GroundItem gi : GroundItemsPlugin.getCollectedGroundItems().values())
|
||||
{
|
||||
if (gi != null)
|
||||
{
|
||||
LocalPoint lp = LocalPoint.fromWorld(client, gi.getLocation());
|
||||
if (lp != null)
|
||||
{
|
||||
if (Perspective.getCanvasTilePoly(client, lp) != null)
|
||||
{
|
||||
Rectangle r1 = FlexoMouse.getClickArea(Perspective.getCanvasTilePoly(client, lp).getBounds());
|
||||
Rectangle r2 = FlexoMouse.getClickArea(r1);
|
||||
Rectangle r3 = FlexoMouse.getClickArea(r2);
|
||||
overlay.clickAreas.add(r3);
|
||||
java.awt.Point p = FlexoMouse.getClickPoint(r3);
|
||||
overlay.clickPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void updateMouseMotionFactory()
|
||||
{
|
||||
Flexo.minDelay = getConfig(configManager).minDelayAmt();
|
||||
MouseMotionFactory factory = new MouseMotionFactory();
|
||||
// TODO:Add Options for various flows to allow more personalization
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
|
||||
private void updateMouseMotionFactory() {
|
||||
Flexo.minDelay = getConfig(configManager).minDelayAmt();
|
||||
MouseMotionFactory factory = new MouseMotionFactory();
|
||||
//TODO:Add Options for various flows to allow more personalization
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
// Always add random
|
||||
flows.add(new Flow(FlowTemplates.random()));
|
||||
|
||||
//Always add random
|
||||
flows.add(new Flow(FlowTemplates.random()));
|
||||
if (getConfig(configManager).getVariatingFlow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.variatingFlow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getVariatingFlow())
|
||||
flows.add(new Flow(FlowTemplates.variatingFlow()));
|
||||
if (getConfig(configManager).getSlowStartupFlow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.slowStartupFlow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getSlowStartupFlow())
|
||||
flows.add(new Flow(FlowTemplates.slowStartupFlow()));
|
||||
if (getConfig(configManager).getSlowStartup2Flow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.slowStartup2Flow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getSlowStartup2Flow())
|
||||
flows.add(new Flow(FlowTemplates.slowStartup2Flow()));
|
||||
if (getConfig(configManager).getJaggedFlow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.jaggedFlow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getJaggedFlow())
|
||||
flows.add(new Flow(FlowTemplates.jaggedFlow()));
|
||||
if (getConfig(configManager).getInterruptedFlow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.interruptedFlow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getInterruptedFlow())
|
||||
flows.add(new Flow(FlowTemplates.interruptedFlow()));
|
||||
if (getConfig(configManager).getInterruptedFlow2())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.interruptedFlow2()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getInterruptedFlow2())
|
||||
flows.add(new Flow(FlowTemplates.interruptedFlow2()));
|
||||
if (getConfig(configManager).getStoppingFlow())
|
||||
{
|
||||
flows.add(new Flow(FlowTemplates.stoppingFlow()));
|
||||
}
|
||||
|
||||
if (getConfig(configManager).getStoppingFlow())
|
||||
flows.add(new Flow(FlowTemplates.stoppingFlow()));
|
||||
DefaultSpeedManager manager = new DefaultSpeedManager(flows);
|
||||
//TODO:Add options for custom Deviation Provider and Noise Provider
|
||||
factory.setDeviationProvider(new SinusoidalDeviationProvider(getConfig(configManager).getDeviationSlope()));
|
||||
factory.setNoiseProvider(new DefaultNoiseProvider(Double.valueOf(getConfig(configManager).getNoisinessDivider())));
|
||||
factory.getNature().setReactionTimeVariationMs(getConfig(configManager).getReactionTimeVariation());
|
||||
manager.setMouseMovementBaseTimeMs(getConfig(configManager).getMouseDragSpeed());
|
||||
|
||||
DefaultSpeedManager manager = new DefaultSpeedManager(flows);
|
||||
//TODO:Add options for custom Deviation Provider and Noise Provider
|
||||
factory.setDeviationProvider(new SinusoidalDeviationProvider(getConfig(configManager).getDeviationSlope()));
|
||||
factory.setNoiseProvider(new DefaultNoiseProvider(Double.valueOf(getConfig(configManager).getNoisinessDivider())));
|
||||
factory.getNature().setReactionTimeVariationMs(getConfig(configManager).getReactionTimeVariation());
|
||||
manager.setMouseMovementBaseTimeMs(getConfig(configManager).getMouseDragSpeed());
|
||||
DefaultOvershootManager overshootManager = (DefaultOvershootManager) factory.getOvershootManager();
|
||||
overshootManager.setOvershoots(getConfig(configManager).getOvershoots());
|
||||
|
||||
DefaultOvershootManager overshootManager = (DefaultOvershootManager) factory.getOvershootManager();
|
||||
overshootManager.setOvershoots(getConfig(configManager).getOvershoots());
|
||||
factory.setSpeedManager(manager);
|
||||
Flexo.currentMouseMotionFactory = factory;
|
||||
}
|
||||
|
||||
factory.setSpeedManager(manager);
|
||||
Flexo.currentMouseMotionFactory = factory;
|
||||
}
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
overlayManager.add(overlay);
|
||||
updateMouseMotionFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
Flexo.isStretched = client.isStretchedEnabled();
|
||||
overlayManager.add(overlay);
|
||||
updateMouseMotionFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,75 +32,75 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("flinching")
|
||||
public interface FlinchingConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 0,
|
||||
keyName = "hexColorFlinch",
|
||||
name = "Overlay Color",
|
||||
description = "Color of flinching timer overlay"
|
||||
)
|
||||
default Color getFlinchOverlayColor()
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
position = 0,
|
||||
keyName = "hexColorFlinch",
|
||||
name = "Overlay Color",
|
||||
description = "Color of flinching timer overlay"
|
||||
)
|
||||
default Color getFlinchOverlayColor()
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 1,
|
||||
keyName = "flinchOverlaySize",
|
||||
name = "Overlay Diameter",
|
||||
description = "Flinch overlay timer diameter"
|
||||
)
|
||||
default int getFlinchOverlaySize()
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
position = 1,
|
||||
keyName = "flinchOverlaySize",
|
||||
name = "Overlay Diameter",
|
||||
description = "Flinch overlay timer diameter"
|
||||
)
|
||||
default int getFlinchOverlaySize()
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 2,
|
||||
keyName = "flinchDelay",
|
||||
name = "Flinch Timer Delay",
|
||||
description = "Shows the appropriate time to attack while flinching milliseconds"
|
||||
)
|
||||
default int getFlinchDelay()
|
||||
{
|
||||
return 5400;
|
||||
}
|
||||
position = 2,
|
||||
keyName = "flinchDelay",
|
||||
name = "Flinch Timer Delay",
|
||||
description = "Shows the appropriate time to attack while flinching milliseconds"
|
||||
)
|
||||
default int getFlinchDelay()
|
||||
{
|
||||
return 5400;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 3,
|
||||
keyName = "flinchOnHitReceivedDelay",
|
||||
name = "Flinch Hit Received Delay",
|
||||
description = "Slightly longer delay after being attacked milliseconds"
|
||||
)
|
||||
default int getFlinchAttackedDelay()
|
||||
{
|
||||
return 6600;
|
||||
}
|
||||
position = 3,
|
||||
keyName = "flinchOnHitReceivedDelay",
|
||||
name = "Flinch Hit Received Delay",
|
||||
description = "Slightly longer delay after being attacked milliseconds"
|
||||
)
|
||||
default int getFlinchAttackedDelay()
|
||||
{
|
||||
return 6600;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 4,
|
||||
keyName = "flinchResetOnHit",
|
||||
name = "Reset on Hit",
|
||||
description = "Timer resets after every attack from your character"
|
||||
)
|
||||
default boolean getFlinchResetOnHit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
position = 4,
|
||||
keyName = "flinchResetOnHit",
|
||||
name = "Reset on Hit",
|
||||
description = "Timer resets after every attack from your character"
|
||||
)
|
||||
default boolean getFlinchResetOnHit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ConfigItem(
|
||||
|
||||
position = 5,
|
||||
keyName = "flinchResetOnHitReceived",
|
||||
name = "Reset on Hit Received",
|
||||
description = "Timer resets when your character gets attacked"
|
||||
)
|
||||
default boolean getFlinchResetOnHitReceived()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
position = 5,
|
||||
keyName = "flinchResetOnHitReceived",
|
||||
name = "Reset on Hit Received",
|
||||
description = "Timer resets when your character gets attacked"
|
||||
)
|
||||
default boolean getFlinchResetOnHitReceived()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,74 +43,74 @@ import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
|
||||
public class FlinchingOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final FlinchingPlugin plugin;
|
||||
private final FlinchingConfig config;
|
||||
private final Client client;
|
||||
private final FlinchingPlugin plugin;
|
||||
private final FlinchingConfig config;
|
||||
|
||||
private Color color;
|
||||
private Color borderColor;
|
||||
private Color color;
|
||||
private Color borderColor;
|
||||
|
||||
private int overlaySize = 25;
|
||||
private int overlaySize;
|
||||
|
||||
@Inject
|
||||
FlinchingOverlay(Client client, FlinchingPlugin plugin, FlinchingConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
@Inject
|
||||
FlinchingOverlay(Client client, FlinchingPlugin plugin, FlinchingConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
|
||||
overlaySize = this.config.getFlinchOverlaySize();
|
||||
}
|
||||
overlaySize = this.config.getFlinchOverlaySize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
drawOverlays(graphics);
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
drawOverlays(graphics);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
borderColor = config.getFlinchOverlayColor();
|
||||
color = new Color(borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue(), 100);
|
||||
public void updateConfig()
|
||||
{
|
||||
borderColor = config.getFlinchOverlayColor();
|
||||
color = new Color(borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue(), 100);
|
||||
|
||||
overlaySize = config.getFlinchOverlaySize();
|
||||
}
|
||||
overlaySize = config.getFlinchOverlaySize();
|
||||
}
|
||||
|
||||
private void drawOverlays(Graphics2D graphics)
|
||||
{
|
||||
for (Map.Entry<Integer, FlinchingTarget> entry : plugin.GetTargets().entrySet())
|
||||
{
|
||||
FlinchingTarget target = entry.getValue();
|
||||
private void drawOverlays(Graphics2D graphics)
|
||||
{
|
||||
for (Map.Entry<Integer, FlinchingTarget> entry : plugin.GetTargets().entrySet())
|
||||
{
|
||||
FlinchingTarget target = entry.getValue();
|
||||
|
||||
drawFlinchTimer(graphics, target.worldLocation, target.GetRemainingTimePercent());
|
||||
}
|
||||
}
|
||||
drawFlinchTimer(graphics, target.worldLocation, target.GetRemainingTimePercent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void drawFlinchTimer(Graphics2D graphics, WorldPoint targetLocation, double fillAmount)
|
||||
{
|
||||
if (targetLocation.getPlane() != client.getPlane())
|
||||
{
|
||||
return;
|
||||
}
|
||||
private void drawFlinchTimer(Graphics2D graphics, WorldPoint targetLocation, double fillAmount)
|
||||
{
|
||||
if (targetLocation.getPlane() != client.getPlane())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LocalPoint localLoc = LocalPoint.fromWorld(client, targetLocation);
|
||||
if (localLoc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LocalPoint localLoc = LocalPoint.fromWorld(client, targetLocation);
|
||||
if (localLoc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane());
|
||||
Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane());
|
||||
|
||||
ProgressPieComponent pie = new ProgressPieComponent();
|
||||
pie.setDiameter(overlaySize);
|
||||
pie.setFill(color);
|
||||
pie.setBorderColor(borderColor);
|
||||
pie.setPosition(loc);
|
||||
pie.setProgress(fillAmount);
|
||||
pie.render(graphics);
|
||||
}
|
||||
ProgressPieComponent pie = new ProgressPieComponent();
|
||||
pie.setDiameter(overlaySize);
|
||||
pie.setFill(color);
|
||||
pie.setBorderColor(borderColor);
|
||||
pie.setPosition(loc);
|
||||
pie.setProgress(fillAmount);
|
||||
pie.render(graphics);
|
||||
}
|
||||
}
|
||||
@@ -24,262 +24,258 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.flinching;
|
||||
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "Flinching Timer",
|
||||
description = "Time your attacks while flinching",
|
||||
tags = {"overlay", "flinching", "timers", "combat"},
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVM
|
||||
name = "Flinching Timer",
|
||||
description = "Time your attacks while flinching",
|
||||
tags = {"overlay", "flinching", "timers", "combat"},
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVM
|
||||
)
|
||||
public class FlinchingPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private FlinchingConfig config;
|
||||
@Inject
|
||||
private FlinchingConfig config;
|
||||
|
||||
@Inject
|
||||
private FlinchingOverlay overlay;
|
||||
@Inject
|
||||
private FlinchingOverlay overlay;
|
||||
|
||||
private int currentWorld = -1;
|
||||
private int currentWorld = -1;
|
||||
|
||||
private int currentInteractingId = -1;
|
||||
private final Map<Integer, FlinchingTarget> flinchingTargets = new HashMap<Integer, FlinchingTarget>();
|
||||
private int currentInteractingId = -1;
|
||||
private final Map<Integer, FlinchingTarget> flinchingTargets = new HashMap<>();
|
||||
|
||||
private boolean resetOnHit = true;
|
||||
private boolean resetOnHitReceived = true;
|
||||
private boolean resetOnHit = true;
|
||||
private boolean resetOnHitReceived = true;
|
||||
|
||||
@Provides
|
||||
FlinchingConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(FlinchingConfig.class);
|
||||
}
|
||||
@Provides
|
||||
FlinchingConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(FlinchingConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
|
||||
overlay.updateConfig();
|
||||
resetOnHit = config.getFlinchResetOnHit();
|
||||
resetOnHitReceived = config.getFlinchResetOnHitReceived();
|
||||
overlay.updateConfig();
|
||||
resetOnHit = config.getFlinchResetOnHit();
|
||||
resetOnHitReceived = config.getFlinchResetOnHitReceived();
|
||||
|
||||
ClearTargets();
|
||||
}
|
||||
ClearTargets();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
ClearTargets();
|
||||
}
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
ClearTargets();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("flinching"))
|
||||
{
|
||||
overlay.updateConfig();
|
||||
resetOnHit = config.getFlinchResetOnHit();
|
||||
resetOnHitReceived = config.getFlinchResetOnHitReceived();
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("flinching"))
|
||||
{
|
||||
overlay.updateConfig();
|
||||
resetOnHit = config.getFlinchResetOnHit();
|
||||
resetOnHitReceived = config.getFlinchResetOnHitReceived();
|
||||
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
FlinchingTarget target = it.next().getValue();
|
||||
if(target != null)
|
||||
{
|
||||
target.SetDelayTime(config.getFlinchDelay(), config.getFlinchAttackedDelay());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<Integer, FlinchingTarget> integerFlinchingTargetEntry : flinchingTargets.entrySet())
|
||||
{
|
||||
FlinchingTarget target = integerFlinchingTargetEntry.getValue();
|
||||
if (target != null)
|
||||
{
|
||||
target.SetDelayTime(config.getFlinchDelay(), config.getFlinchAttackedDelay());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
if (currentWorld == -1)
|
||||
{
|
||||
currentWorld = client.getWorld();
|
||||
}
|
||||
else if (currentWorld != client.getWorld())
|
||||
{
|
||||
ClearTargets();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
if (currentWorld == -1)
|
||||
{
|
||||
currentWorld = client.getWorld();
|
||||
}
|
||||
else if (currentWorld != client.getWorld())
|
||||
{
|
||||
ClearTargets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearTargets()
|
||||
{
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
private void ClearTargets()
|
||||
{
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick tick)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick tick)
|
||||
{
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
TickTargets();
|
||||
checkInteracting();
|
||||
}
|
||||
}
|
||||
TickTargets();
|
||||
checkInteracting();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onHitsplatApplied(HitsplatApplied hitsplatApplied)
|
||||
{
|
||||
Actor actor = hitsplatApplied.getActor();
|
||||
@Subscribe
|
||||
public void onHitsplatApplied(HitsplatApplied hitsplatApplied)
|
||||
{
|
||||
Actor actor = hitsplatApplied.getActor();
|
||||
|
||||
if (actor instanceof NPC)
|
||||
{
|
||||
NPC hitTarget = (NPC) actor;
|
||||
if (actor instanceof NPC)
|
||||
{
|
||||
NPC hitTarget = (NPC) actor;
|
||||
|
||||
int hitId = hitTarget.getId();
|
||||
if(hitId == currentInteractingId)
|
||||
{
|
||||
if (!flinchingTargets.containsKey(hitId))
|
||||
{
|
||||
TargetGained(hitTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
FlinchingTarget currentTarget = flinchingTargets.get(hitId);
|
||||
if(currentTarget != null)
|
||||
{
|
||||
if(resetOnHit)
|
||||
{
|
||||
currentTarget.TargetHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(resetOnHitReceived && actor == client.getLocalPlayer())
|
||||
{
|
||||
PlayerHit();
|
||||
}
|
||||
}
|
||||
int hitId = hitTarget.getId();
|
||||
if (hitId == currentInteractingId)
|
||||
{
|
||||
if (!flinchingTargets.containsKey(hitId))
|
||||
{
|
||||
TargetGained(hitTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
FlinchingTarget currentTarget = flinchingTargets.get(hitId);
|
||||
if (currentTarget != null)
|
||||
{
|
||||
if (resetOnHit)
|
||||
{
|
||||
currentTarget.TargetHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (resetOnHitReceived && actor == client.getLocalPlayer())
|
||||
{
|
||||
PlayerHit();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkInteracting()
|
||||
{
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
Actor interacting = localPlayer.getInteracting();
|
||||
private void checkInteracting()
|
||||
{
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
Actor interacting = localPlayer.getInteracting();
|
||||
|
||||
if (interacting instanceof NPC)
|
||||
{
|
||||
NPC newTarget = (NPC) interacting;
|
||||
currentInteractingId = newTarget.getId();
|
||||
if (interacting instanceof NPC)
|
||||
{
|
||||
NPC newTarget = (NPC) interacting;
|
||||
currentInteractingId = newTarget.getId();
|
||||
|
||||
if(newTarget.getHealth() <= 0 || newTarget.isDead())
|
||||
{
|
||||
if (flinchingTargets.containsKey(currentInteractingId))
|
||||
{
|
||||
flinchingTargets.remove(currentInteractingId);
|
||||
currentInteractingId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newTarget.getHealth() <= 0 || newTarget.isDead())
|
||||
{
|
||||
if (flinchingTargets.containsKey(currentInteractingId))
|
||||
{
|
||||
flinchingTargets.remove(currentInteractingId);
|
||||
currentInteractingId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TickTargets()
|
||||
{
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
private void TickTargets()
|
||||
{
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
FlinchingTarget target = it.next().getValue();
|
||||
if(target != null)
|
||||
{
|
||||
target.Tick();
|
||||
if(target.isActive == false)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
while (it.hasNext())
|
||||
{
|
||||
FlinchingTarget target = it.next().getValue();
|
||||
if (target != null)
|
||||
{
|
||||
target.Tick();
|
||||
if (!target.isActive)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcDespawned(NpcDespawned npcDespawned)
|
||||
{
|
||||
NPC actor = npcDespawned.getNpc();
|
||||
@Subscribe
|
||||
public void onNpcDespawned(NpcDespawned npcDespawned)
|
||||
{
|
||||
NPC actor = npcDespawned.getNpc();
|
||||
|
||||
int actorId = actor.getId();
|
||||
if (actor.isDead() && flinchingTargets.containsKey(actorId))
|
||||
{
|
||||
TargetLost(actorId);
|
||||
}
|
||||
}
|
||||
int actorId = actor.getId();
|
||||
if (actor.isDead() && flinchingTargets.containsKey(actorId))
|
||||
{
|
||||
TargetLost(actorId);
|
||||
}
|
||||
}
|
||||
|
||||
private void TargetLost(int targetId)
|
||||
{
|
||||
flinchingTargets.remove(targetId);
|
||||
}
|
||||
private void TargetLost(int targetId)
|
||||
{
|
||||
flinchingTargets.remove(targetId);
|
||||
}
|
||||
|
||||
private void TargetGained(NPC _newTarget)
|
||||
{
|
||||
FlinchingTarget newTarget = new FlinchingTarget(_newTarget);
|
||||
newTarget.SetDelayTime(config.getFlinchDelay(), config.getFlinchAttackedDelay());
|
||||
flinchingTargets.put(_newTarget.getId(), newTarget);
|
||||
}
|
||||
private void TargetGained(NPC _newTarget)
|
||||
{
|
||||
FlinchingTarget newTarget = new FlinchingTarget(_newTarget);
|
||||
newTarget.SetDelayTime(config.getFlinchDelay(), config.getFlinchAttackedDelay());
|
||||
flinchingTargets.put(_newTarget.getId(), newTarget);
|
||||
}
|
||||
|
||||
public void PlayerHit()
|
||||
{
|
||||
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
FlinchingTarget target = it.next().getValue();
|
||||
if(target != null)
|
||||
{
|
||||
target.PlayerHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void PlayerHit()
|
||||
{
|
||||
for (Map.Entry<Integer, FlinchingTarget> integerFlinchingTargetEntry : flinchingTargets.entrySet())
|
||||
{
|
||||
FlinchingTarget target = integerFlinchingTargetEntry.getValue();
|
||||
if (target != null)
|
||||
{
|
||||
target.PlayerHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Integer, FlinchingTarget> GetTargets()
|
||||
{
|
||||
return(flinchingTargets);
|
||||
}
|
||||
Map<Integer, FlinchingTarget> GetTargets()
|
||||
{
|
||||
return (flinchingTargets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,113 +32,113 @@ import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class FlinchingTarget
|
||||
{
|
||||
private int currentDisplayLength = 5400;
|
||||
private int currentDisplayLength = 5400;
|
||||
|
||||
private boolean usingHitDelay = false;
|
||||
private boolean usingHitDelay = false;
|
||||
|
||||
private int displayLength = 5400;
|
||||
private int displayHitReceivedLength = 6600;
|
||||
private Instant lastAttacked;
|
||||
private int displayLength = 5400;
|
||||
private int displayHitReceivedLength = 6600;
|
||||
private Instant lastAttacked;
|
||||
|
||||
public boolean isActive = false;
|
||||
public boolean isActive;
|
||||
|
||||
@Getter
|
||||
private int objectId;
|
||||
private NPC targetObject;
|
||||
@Getter
|
||||
private int objectId;
|
||||
private NPC targetObject;
|
||||
|
||||
@Getter
|
||||
public WorldPoint worldLocation;
|
||||
@Getter
|
||||
public WorldPoint worldLocation;
|
||||
|
||||
public FlinchingTarget(NPC target)
|
||||
{
|
||||
isActive = true;
|
||||
FlinchingTarget(NPC target)
|
||||
{
|
||||
isActive = true;
|
||||
|
||||
this.targetObject = target;
|
||||
this.lastAttacked = Instant.now();
|
||||
this.objectId = target.getId();
|
||||
this.worldLocation = target.getWorldLocation();
|
||||
}
|
||||
this.targetObject = target;
|
||||
this.lastAttacked = Instant.now();
|
||||
this.objectId = target.getId();
|
||||
this.worldLocation = target.getWorldLocation();
|
||||
}
|
||||
|
||||
public void TargetHit()
|
||||
{
|
||||
boolean shouldHit = true;
|
||||
if(usingHitDelay)
|
||||
{
|
||||
if(GetRemainingTime() > displayLength)
|
||||
{
|
||||
shouldHit = false;
|
||||
}
|
||||
}
|
||||
void TargetHit()
|
||||
{
|
||||
boolean shouldHit = true;
|
||||
if (usingHitDelay)
|
||||
{
|
||||
if (GetRemainingTime() > displayLength)
|
||||
{
|
||||
shouldHit = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(shouldHit)
|
||||
{
|
||||
lastAttacked = Instant.now();
|
||||
if (shouldHit)
|
||||
{
|
||||
lastAttacked = Instant.now();
|
||||
|
||||
usingHitDelay = false;
|
||||
currentDisplayLength = displayLength;
|
||||
}
|
||||
}
|
||||
usingHitDelay = false;
|
||||
currentDisplayLength = displayLength;
|
||||
}
|
||||
}
|
||||
|
||||
public double GetRemainingTimePercent()
|
||||
{
|
||||
double remainingTime = GetRemainingTime();
|
||||
double timePercent = remainingTime / currentDisplayLength;
|
||||
if(timePercent < 0)
|
||||
{
|
||||
timePercent = 0;
|
||||
}
|
||||
else if(timePercent > 1)
|
||||
{
|
||||
timePercent = 1;
|
||||
}
|
||||
double GetRemainingTimePercent()
|
||||
{
|
||||
double remainingTime = GetRemainingTime();
|
||||
double timePercent = remainingTime / currentDisplayLength;
|
||||
if (timePercent < 0)
|
||||
{
|
||||
timePercent = 0;
|
||||
}
|
||||
else if (timePercent > 1)
|
||||
{
|
||||
timePercent = 1;
|
||||
}
|
||||
|
||||
return(timePercent);
|
||||
}
|
||||
return (timePercent);
|
||||
}
|
||||
|
||||
private double GetRemainingTime()
|
||||
{
|
||||
Duration duration = Duration.between(lastAttacked, Instant.now());
|
||||
return( (currentDisplayLength - ((double)duration.toMillis())));
|
||||
}
|
||||
private double GetRemainingTime()
|
||||
{
|
||||
Duration duration = Duration.between(lastAttacked, Instant.now());
|
||||
return ((currentDisplayLength - ((double) duration.toMillis())));
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
if(targetObject == null)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
worldLocation = targetObject.getWorldLocation();
|
||||
void Tick()
|
||||
{
|
||||
if (targetObject == null)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
worldLocation = targetObject.getWorldLocation();
|
||||
|
||||
double remainingTime = GetRemainingTime();
|
||||
if(remainingTime <= 0)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
double remainingTime = GetRemainingTime();
|
||||
if (remainingTime <= 0)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDelayTime(int delayTime, int delayHitReceivedTime)
|
||||
{
|
||||
displayLength = delayTime;
|
||||
displayHitReceivedLength = delayHitReceivedTime;
|
||||
void SetDelayTime(int delayTime, int delayHitReceivedTime)
|
||||
{
|
||||
displayLength = delayTime;
|
||||
displayHitReceivedLength = delayHitReceivedTime;
|
||||
|
||||
if(usingHitDelay)
|
||||
{
|
||||
currentDisplayLength = displayHitReceivedLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDisplayLength = displayLength;
|
||||
}
|
||||
}
|
||||
if (usingHitDelay)
|
||||
{
|
||||
currentDisplayLength = displayHitReceivedLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDisplayLength = displayLength;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerHit()
|
||||
{
|
||||
usingHitDelay = true;
|
||||
currentDisplayLength = displayHitReceivedLength;
|
||||
void PlayerHit()
|
||||
{
|
||||
usingHitDelay = true;
|
||||
currentDisplayLength = displayHitReceivedLength;
|
||||
|
||||
lastAttacked = Instant.now();
|
||||
}
|
||||
lastAttacked = Instant.now();
|
||||
}
|
||||
}
|
||||
@@ -29,37 +29,39 @@ import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("hydra")
|
||||
public interface HydraConfig extends Config {
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hydraenable",
|
||||
name = "Enable Hydra (194 cb) Helper",
|
||||
description = "Configures whether or not to enable Hydra Helper. (For use on regular hydra's only, will not work with Alchemical Hydra)."
|
||||
)
|
||||
default boolean EnableHydra() { return true; }
|
||||
public interface HydraConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "textindicators",
|
||||
name = "Text Indicator",
|
||||
description = "Configures if text indicator is shown above hydra's or not."
|
||||
position = 1,
|
||||
keyName = "textindicators",
|
||||
name = "Text Indicator",
|
||||
description = "Configures if text indicator is shown above hydra's or not."
|
||||
)
|
||||
default boolean TextIndicator() { return true; }
|
||||
default boolean TextIndicator()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "countersize",
|
||||
name = "Bold indicator",
|
||||
description = "Configures if text indicator is bold or not."
|
||||
position = 2,
|
||||
keyName = "countersize",
|
||||
name = "Bold indicator",
|
||||
description = "Configures if text indicator is bold or not."
|
||||
)
|
||||
default boolean BoldText() { return false; }
|
||||
default boolean BoldText()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "prayerhelper",
|
||||
name = "Prayer Helper",
|
||||
description = "Configures if prayer helper is shown or not."
|
||||
position = 3,
|
||||
keyName = "prayerhelper",
|
||||
name = "Prayer Helper",
|
||||
description = "Configures if prayer helper is shown or not."
|
||||
)
|
||||
default boolean PrayerHelper() { return true; }
|
||||
|
||||
default boolean PrayerHelper()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,53 +24,53 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.hydra;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
public class HydraIndicatorOverlay extends Overlay
|
||||
{
|
||||
private final HydraConfig config;
|
||||
private final HydraPlugin plugin;
|
||||
|
||||
public class HydraIndicatorOverlay extends Overlay {
|
||||
private final HydraConfig config;
|
||||
private final HydraPlugin plugin;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
@Inject
|
||||
private HydraIndicatorOverlay(HydraConfig config, HydraPlugin plugin)
|
||||
{
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
setPriority(OverlayPriority.MED);
|
||||
panelComponent.setPreferredSize(new Dimension(14, 0));
|
||||
}
|
||||
|
||||
@Inject
|
||||
private HydraIndicatorOverlay(HydraConfig config, HydraPlugin plugin) {
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
setPriority(OverlayPriority.MED);
|
||||
panelComponent.setPreferredSize(new Dimension(14, 0));
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.PrayerHelper())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (!config.PrayerHelper()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (plugin.Hydra != null) {
|
||||
if (plugin.hydras.containsKey(plugin.Hydra.getIndex())) {
|
||||
int val = plugin.hydras.get(plugin.Hydra.getIndex());
|
||||
if (val != 0) {
|
||||
panelComponent.getChildren().clear();
|
||||
panelComponent.getChildren().add(LineComponent.builder().right(Integer.toString(val)).build());
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (plugin.Hydra != null)
|
||||
{
|
||||
if (plugin.hydras.containsKey(plugin.Hydra.getIndex()))
|
||||
{
|
||||
int val = plugin.hydras.get(plugin.Hydra.getIndex());
|
||||
if (val != 0)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
panelComponent.getChildren().add(LineComponent.builder().right(Integer.toString(val)).build());
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,16 +24,23 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.hydra;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
public class HydraOverlay extends Overlay {
|
||||
public class HydraOverlay extends Overlay
|
||||
{
|
||||
private final HydraConfig config;
|
||||
private final HydraPlugin plugin;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
@@ -43,7 +50,8 @@ public class HydraOverlay extends Overlay {
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private HydraOverlay(HydraConfig config, HydraPlugin plugin) {
|
||||
private HydraOverlay(HydraConfig config, HydraPlugin plugin)
|
||||
{
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
@@ -53,41 +61,60 @@ public class HydraOverlay extends Overlay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (!config.TextIndicator()) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.TextIndicator())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (NPC hydra : client.getNpcs()) {
|
||||
if (hydra == null || hydra.getName() == null) {
|
||||
for (NPC hydra : client.getNpcs())
|
||||
{
|
||||
if (hydra == null || hydra.getName() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra")) {
|
||||
if (plugin.hydras.containsKey(hydra.getIndex())) {
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
||||
{
|
||||
if (plugin.hydras.containsKey(hydra.getIndex()))
|
||||
{
|
||||
int val = plugin.hydras.get(hydra.getIndex());
|
||||
if (val != 0) {
|
||||
if (config.BoldText()) {
|
||||
if (val != 0)
|
||||
{
|
||||
if (config.BoldText())
|
||||
{
|
||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||
}
|
||||
if (plugin.hydraattacks.containsKey(hydra.getIndex())) {
|
||||
if (plugin.hydraattacks.containsKey(hydra.getIndex()))
|
||||
{
|
||||
int attack = plugin.hydraattacks.get(hydra.getIndex());
|
||||
if (attack == 8261) {
|
||||
if (val == 3) {
|
||||
if (attack == 8261)
|
||||
{
|
||||
if (val == 3)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, hydra.getCanvasTextLocation(graphics, "MAGE", hydra.getLogicalHeight() + 100), "MAGE", Color.BLUE);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, hydra.getCanvasTextLocation(graphics, "RANGE", hydra.getLogicalHeight() + 100), "RANGE", Color.GREEN);
|
||||
}
|
||||
} else if (attack == 8262) {
|
||||
if (val == 3) {
|
||||
}
|
||||
else if (attack == 8262)
|
||||
{
|
||||
if (val == 3)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, hydra.getCanvasTextLocation(graphics, "RANGE", hydra.getLogicalHeight() + 100), "RANGE", Color.GREEN);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, hydra.getCanvasTextLocation(graphics, "MAGE", hydra.getLogicalHeight() + 100), "MAGE", Color.BLUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
Point runelitepleaseexplainwhyineedtocheckthisfornullinsteadoftheentirehydravariablethisshitcostmelikeanhourofmylifeandiblameyouadam = hydra.getCanvasTextLocation(graphics, Integer.toString(val), hydra.getLogicalHeight() + 40);
|
||||
if (runelitepleaseexplainwhyineedtocheckthisfornullinsteadoftheentirehydravariablethisshitcostmelikeanhourofmylifeandiblameyouadam != null) {
|
||||
OverlayUtil.renderTextLocation(graphics, runelitepleaseexplainwhyineedtocheckthisfornullinsteadoftheentirehydravariablethisshitcostmelikeanhourofmylifeandiblameyouadam, Integer.toString(val), Color.WHITE);
|
||||
Point hydraPoint = hydra.getCanvasTextLocation(graphics, Integer.toString(val), hydra.getLogicalHeight() + 40);
|
||||
if (hydraPoint != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, hydraPoint, Integer.toString(val), Color.WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,21 +24,24 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.hydra;
|
||||
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Hydra Helper",
|
||||
description = "Hydra Helper",
|
||||
@@ -65,11 +68,9 @@ public class HydraPlugin extends Plugin
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
@Provides
|
||||
HydraConfig provideConfig(ConfigManager configManager) {
|
||||
HydraConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(HydraConfig.class);
|
||||
}
|
||||
|
||||
@@ -78,14 +79,16 @@ public class HydraPlugin extends Plugin
|
||||
NPC Hydra;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(HydraOverlay);
|
||||
overlayManager.add(HydraPrayOverlay);
|
||||
overlayManager.add(HydraIndicatorOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(HydraOverlay);
|
||||
overlayManager.remove(HydraPrayOverlay);
|
||||
overlayManager.remove(HydraIndicatorOverlay);
|
||||
@@ -94,14 +97,15 @@ public class HydraPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcSpawned(NpcSpawned event) {
|
||||
if (!config.EnableHydra()) {
|
||||
return;
|
||||
}
|
||||
public void onNpcSpawned(NpcSpawned event)
|
||||
{
|
||||
NPC hydra = event.getNpc();
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null) {
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra")) {
|
||||
if (!hydras.containsKey(hydra.getIndex())) {
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
|
||||
{
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
||||
{
|
||||
if (!hydras.containsKey(hydra.getIndex()))
|
||||
{
|
||||
hydras.put(hydra.getIndex(), 3);
|
||||
}
|
||||
}
|
||||
@@ -109,56 +113,71 @@ public class HydraPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcDespawned(NpcDespawned event) {
|
||||
if (!config.EnableHydra()) {
|
||||
return;
|
||||
}
|
||||
public void onNpcDespawned(NpcDespawned event)
|
||||
{
|
||||
NPC hydra = event.getNpc();
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null) {
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra")) {
|
||||
if (hydras.containsKey(hydra.getIndex())) {
|
||||
hydras.remove(hydra.getIndex());
|
||||
}
|
||||
if (hydraattacks.containsKey(hydra.getIndex())) {
|
||||
hydraattacks.remove(hydra.getIndex());
|
||||
}
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
|
||||
{
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
||||
{
|
||||
hydras.remove(hydra.getIndex());
|
||||
hydraattacks.remove(hydra.getIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged event) {
|
||||
public void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
Actor monster = event.getActor();
|
||||
Actor local = client.getLocalPlayer();
|
||||
if (monster instanceof NPC) {
|
||||
if (monster instanceof NPC)
|
||||
{
|
||||
NPC hydra = (NPC) monster;
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null) {
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra")) {
|
||||
if (hydras.containsKey(hydra.getIndex())) {
|
||||
if (hydra.getAnimation() == 8261 || hydra.getAnimation() == 8262) {
|
||||
if (hydra.getInteracting().equals(local)) {
|
||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
|
||||
{
|
||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
||||
{
|
||||
if (hydras.containsKey(hydra.getIndex()))
|
||||
{
|
||||
if (hydra.getAnimation() == 8261 || hydra.getAnimation() == 8262)
|
||||
{
|
||||
if (hydra.getInteracting().equals(local))
|
||||
{
|
||||
Hydra = hydra;
|
||||
}
|
||||
if (hydraattacks.containsKey(hydra.getIndex())) {
|
||||
if (hydraattacks.containsKey(hydra.getIndex()))
|
||||
{
|
||||
int lastattack = hydraattacks.get(hydra.getIndex());
|
||||
hydraattacks.replace(hydra.getIndex(), hydra.getAnimation());
|
||||
|
||||
if (lastattack != hydra.getAnimation()) {
|
||||
if (lastattack != hydra.getAnimation())
|
||||
{
|
||||
hydras.replace(hydra.getIndex(), 2);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
int currval = hydras.get(hydra.getIndex());
|
||||
if (currval == 1) {
|
||||
if (currval == 1)
|
||||
{
|
||||
hydras.replace(hydra.getIndex(), 3);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
hydras.replace(hydra.getIndex(), currval - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
hydraattacks.put(hydra.getIndex(), hydra.getAnimation());
|
||||
int currval = hydras.get(hydra.getIndex());
|
||||
if (currval == 1) {
|
||||
if (currval == 1)
|
||||
{
|
||||
hydras.replace(hydra.getIndex(), 3);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
hydras.replace(hydra.getIndex(), currval - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,101 +24,122 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.hydra;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
public class HydraPrayOverlay extends Overlay {
|
||||
private final HydraConfig config;
|
||||
private final HydraPlugin plugin;
|
||||
public class HydraPrayOverlay extends Overlay
|
||||
{
|
||||
private final HydraConfig config;
|
||||
private final HydraPlugin plugin;
|
||||
|
||||
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
||||
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
||||
|
||||
private final SpriteManager spriteManager;
|
||||
private final PanelComponent imagePanelComponent = new PanelComponent();
|
||||
private final SpriteManager spriteManager;
|
||||
private final PanelComponent imagePanelComponent = new PanelComponent();
|
||||
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private HydraPrayOverlay(HydraConfig config, HydraPlugin plugin, SpriteManager spriteManager) {
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
this.spriteManager = spriteManager;
|
||||
}
|
||||
@Inject
|
||||
private HydraPrayOverlay(HydraConfig config, HydraPlugin plugin, SpriteManager spriteManager)
|
||||
{
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
this.spriteManager = spriteManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (!config.PrayerHelper()) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.PrayerHelper())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (plugin.Hydra != null) {
|
||||
if (plugin.hydras.containsKey(plugin.Hydra.getIndex())) {
|
||||
int val = plugin.hydras.get(plugin.Hydra.getIndex());
|
||||
if (val != 0) {
|
||||
if (plugin.hydraattacks.containsKey(plugin.Hydra.getIndex())) {
|
||||
int attack = plugin.hydraattacks.get(plugin.Hydra.getIndex());
|
||||
if (attack == 8261) {
|
||||
if (val == 3) {
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
|
||||
if (plugin.Hydra != null)
|
||||
{
|
||||
if (plugin.hydras.containsKey(plugin.Hydra.getIndex()))
|
||||
{
|
||||
int val = plugin.hydras.get(plugin.Hydra.getIndex());
|
||||
if (val != 0)
|
||||
{
|
||||
if (plugin.hydraattacks.containsKey(plugin.Hydra.getIndex()))
|
||||
{
|
||||
int attack = plugin.hydraattacks.get(plugin.Hydra.getIndex());
|
||||
if (attack == 8261)
|
||||
{
|
||||
if (val == 3)
|
||||
{
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
|
||||
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
|
||||
return imagePanelComponent.render(graphics);
|
||||
} else {
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
else
|
||||
{
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
} else if (attack == 8262) {
|
||||
if (val == 3) {
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
else if (attack == 8262)
|
||||
{
|
||||
if (val == 3)
|
||||
{
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
|
||||
return imagePanelComponent.render(graphics);
|
||||
} else {
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
else
|
||||
{
|
||||
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
|
||||
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
imagePanelComponent.getChildren().clear();
|
||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return imagePanelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,30 +31,47 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("learntoclick")
|
||||
public interface LearnToClickConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(position = 1, keyName = "blockCompass", name = "Compass", description = "Prevents the camera from moving when you misclick on the compass")
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "blockCompass",
|
||||
name = "Compass",
|
||||
description = "Prevents the camera from moving when you misclick on the compass"
|
||||
)
|
||||
default boolean shouldBlockCompass()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 2, keyName = "rightClickMap", name = "World Map", description = "Prevents the world map from opening on left click without disabling it entirely")
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "rightClickMap",
|
||||
name = "World Map",
|
||||
description = "Prevents the world map from opening on left click without disabling it entirely"
|
||||
)
|
||||
default boolean shouldRightClickMap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 3, keyName = "rightClickXp", name = "Xp Drops Toggle", description = "Prevents toggling xp drops on left click without disabling the toggle function entirely")
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "rightClickXp",
|
||||
name = "Xp Drops Toggle",
|
||||
description = "Prevents toggling xp drops on left click without disabling the toggle function entirely"
|
||||
)
|
||||
default boolean shouldRightClickXp()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 4, keyName = "rightClickRetaliate", name = "Auto Retaliate", description = "Prevents toggling auto retaliate on left click without disabling the toggle function entirely")
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "rightClickRetaliate",
|
||||
name = "Auto Retaliate",
|
||||
description = "Prevents toggling auto retaliate on left click without disabling the toggle function entirely"
|
||||
)
|
||||
default boolean shouldRightClickRetaliate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -38,7 +38,6 @@ public class LearnToClickPlugin extends Plugin
|
||||
@Inject
|
||||
private LearnToClickConfig config;
|
||||
private boolean forceRightClickFlag;
|
||||
private MenuEntry[] entries;
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -86,7 +85,7 @@ public class LearnToClickPlugin extends Plugin
|
||||
{
|
||||
forceRightClickFlag = true;
|
||||
}
|
||||
entries = client.getMenuEntries();
|
||||
MenuEntry[] entries = client.getMenuEntries();
|
||||
if (config.shouldBlockCompass())
|
||||
{
|
||||
for (int i = entries.length - 1; i >= 0; i--)
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
@@ -21,16 +20,12 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class LootAssistOverlay extends Overlay
|
||||
{
|
||||
|
||||
|
||||
private LootAssistPlugin plugin;
|
||||
private Client client;
|
||||
private DecimalFormat d = new DecimalFormat("##.#");
|
||||
|
||||
@Inject
|
||||
public LootAssistOverlay(Client client, LootAssistPlugin plugin)
|
||||
public LootAssistOverlay(Client client)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
@@ -48,9 +43,7 @@ public class LootAssistOverlay extends Overlay
|
||||
int y;
|
||||
try
|
||||
{
|
||||
|
||||
x = LocalPoint.fromWorld(client, pile.getLocation()).getSceneX();
|
||||
|
||||
y = LocalPoint.fromWorld(client, pile.getLocation()).getSceneY();
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
@@ -73,32 +66,32 @@ public class LootAssistOverlay extends Overlay
|
||||
{
|
||||
String nameOverlay = pile.getPlayerName();
|
||||
String timeOverlay = d.format((pile.getTimeAppearing() - System.currentTimeMillis()) / 1000f);
|
||||
final Polygon poly = Perspective.getCanvasTilePoly(client,
|
||||
client.getScene().getTiles()[client.getPlane()][x][y].getLocalLocation());
|
||||
if (poly != null)
|
||||
{
|
||||
Point textLoc = Perspective.getCanvasTextLocation(client, graphics,
|
||||
LocalPoint.fromWorld(client, pile.getLocation()),
|
||||
nameOverlay, graphics.getFontMetrics().getHeight() * 7);
|
||||
Point timeLoc = Perspective.getCanvasTextLocation(client, graphics,
|
||||
LocalPoint.fromWorld(client, pile.getLocation()),
|
||||
timeOverlay, graphics.getFontMetrics().getHeight());
|
||||
OverlayUtil.renderPolygon(graphics, poly, Color.WHITE);
|
||||
if (timeRemaining < 5)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.RED);
|
||||
OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.RED);
|
||||
}
|
||||
if (timeRemaining < 2)
|
||||
{
|
||||
client.setHintArrow(WorldPoint.fromLocal(client,
|
||||
LocalPoint.fromWorld(client, pile.getLocation())));
|
||||
}
|
||||
else
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.WHITE);
|
||||
OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.WHITE);
|
||||
}
|
||||
final Polygon poly = Perspective.getCanvasTilePoly(client,
|
||||
client.getScene().getTiles()[client.getPlane()][x][y].getLocalLocation());
|
||||
if (poly != null)
|
||||
{
|
||||
Point textLoc = Perspective.getCanvasTextLocation(client, graphics,
|
||||
LocalPoint.fromWorld(client, pile.getLocation()),
|
||||
nameOverlay, graphics.getFontMetrics().getHeight() * 7);
|
||||
Point timeLoc = Perspective.getCanvasTextLocation(client, graphics,
|
||||
LocalPoint.fromWorld(client, pile.getLocation()),
|
||||
timeOverlay, graphics.getFontMetrics().getHeight());
|
||||
OverlayUtil.renderPolygon(graphics, poly, Color.WHITE);
|
||||
if (timeRemaining < 5)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.RED);
|
||||
OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.RED);
|
||||
}
|
||||
if (timeRemaining < 2)
|
||||
{
|
||||
client.setHintArrow(WorldPoint.fromLocal(client,
|
||||
LocalPoint.fromWorld(client, pile.getLocation())));
|
||||
}
|
||||
else
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.WHITE);
|
||||
OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.WHITE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,11 @@ package net.runelite.client.plugins.lootassist;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
@@ -28,21 +26,13 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
)
|
||||
public class LootAssistPlugin extends Plugin
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
LootAssistOverlay lootAssistOverlay;
|
||||
|
||||
@Inject
|
||||
private LootAssitConfig config;
|
||||
|
||||
|
||||
public static ConcurrentHashMap<WorldPoint, LootPile> lootPiles = new ConcurrentHashMap<>();
|
||||
static ConcurrentHashMap<WorldPoint, LootPile> lootPiles = new ConcurrentHashMap<>();
|
||||
|
||||
@Provides
|
||||
LootAssitConfig getConfig(ConfigManager configManager)
|
||||
|
||||
@@ -5,24 +5,28 @@ import lombok.Setter;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class LootPile
|
||||
class LootPile
|
||||
{
|
||||
private static final long TIME_UNTIL_VISIBLE = 60000;
|
||||
private final long timeCreated;
|
||||
|
||||
@Getter
|
||||
private final long timeAppearing;
|
||||
|
||||
@Getter
|
||||
private final WorldPoint location;
|
||||
|
||||
@Getter
|
||||
private final String playerName;
|
||||
@Getter @Setter
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean beingRendered = false;
|
||||
|
||||
public LootPile(WorldPoint location, String playerName)
|
||||
LootPile(WorldPoint location, String playerName)
|
||||
{
|
||||
this.timeCreated = System.currentTimeMillis();
|
||||
long timeCreated = System.currentTimeMillis();
|
||||
this.location = location;
|
||||
this.playerName = playerName;
|
||||
this.timeAppearing = this.timeCreated + TIME_UNTIL_VISIBLE;
|
||||
this.timeAppearing = timeCreated + TIME_UNTIL_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,20 +74,26 @@ class LootingBagViewerOverlay extends Overlay
|
||||
{
|
||||
if(client.getItemContainer(InventoryID.LOOTING_BAG) != null) {
|
||||
itemContainer = client.getItemContainer(InventoryID.LOOTING_BAG);
|
||||
items = itemContainer.getItems();
|
||||
if (itemContainer != null)
|
||||
{
|
||||
items = itemContainer.getItems();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if(itemContainer != null && client.getItemContainer(InventoryID.LOOTING_BAG) != null)
|
||||
else if(items != null && client.getItemContainer(InventoryID.LOOTING_BAG) != null)
|
||||
{
|
||||
itemContainer = client.getItemContainer(InventoryID.LOOTING_BAG);
|
||||
Item[] tempItems = itemContainer.getItems();
|
||||
|
||||
for(int i = 0; i < items.length; i++)
|
||||
if (itemContainer != null)
|
||||
{
|
||||
if(!items[i].equals(tempItems[i]))
|
||||
Item[] tempItems = itemContainer.getItems();
|
||||
|
||||
for (int i = 0; i < items.length; i++)
|
||||
{
|
||||
items = tempItems;
|
||||
if (!items[i].equals(tempItems[i]))
|
||||
{
|
||||
items = tempItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,24 +31,51 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("menumodifier")
|
||||
public interface MenuModifierConfig extends Config
|
||||
{
|
||||
@ConfigItem(position = 0, keyName = "hideCancel", name = "Hide Cancel", description = "Hides the 'cancel' option from the right click menu")
|
||||
default boolean hideCancel() { return true; }
|
||||
|
||||
@ConfigItem(position = 1, keyName = "hideExamine", name = "Hide Examine", description = "Hides the 'examine' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hideExamine",
|
||||
name = "Hide Examine",
|
||||
description = "Hides the 'examine' option from the right click menu"
|
||||
)
|
||||
default boolean hideExamine() { return true; }
|
||||
|
||||
@ConfigItem(position = 2, keyName = "hideTradeWith", name = "Hide Trade With", description = "Hides the 'trade with' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "hideTradeWith",
|
||||
name = "Hide Trade With",
|
||||
description = "Hides the 'trade with' option from the right click menu"
|
||||
)
|
||||
default boolean hideTradeWith() { return true; }
|
||||
|
||||
@ConfigItem(position = 3, keyName = "hideReport", name = "Hide Report", description = "Hides the 'report' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "hideReport",
|
||||
name = "Hide Report",
|
||||
description = "Hides the 'report' option from the right click menu"
|
||||
)
|
||||
default boolean hideReport() { return true; }
|
||||
|
||||
@ConfigItem(position = 4, keyName = "hideLookup", name = "Hide Lookup", description = "Hides the 'lookup' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "hideLookup",
|
||||
name = "Hide Lookup",
|
||||
description = "Hides the 'lookup' option from the right click menu"
|
||||
)
|
||||
default boolean hideLookup() { return true; }
|
||||
|
||||
@ConfigItem(position = 4, keyName = "hideNet", name = "Hide Net", description = "Hides the 'net' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "hideNet",
|
||||
name = "Hide Net",
|
||||
description = "Hides the 'net' option from the right click menu"
|
||||
)
|
||||
default boolean hideNet() { return true; }
|
||||
|
||||
@ConfigItem(position = 4, keyName = "hideBait", name = "Hide Bait", description = "Hides the 'Bait' option from the right click menu")
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "hideBait",
|
||||
name = "Hide Bait",
|
||||
description = "Hides the 'Bait' option from the right click menu"
|
||||
)
|
||||
default boolean hideBait() { return true; }
|
||||
}
|
||||
|
||||
@@ -24,40 +24,39 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.menumodifier;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.MouseAdapter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public class MenuModifierInputListener extends MouseAdapter implements KeyListener
|
||||
{
|
||||
private static final int HOTKEY = KeyEvent.VK_CONTROL;
|
||||
private static final int HOTKEY = KeyEvent.VK_CONTROL;
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
private MenuModifierPlugin plugin;
|
||||
@Inject
|
||||
private MenuModifierPlugin plugin;
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == HOTKEY)
|
||||
{
|
||||
plugin.setHotKeyPressed(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == HOTKEY)
|
||||
{
|
||||
plugin.setHotKeyPressed(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == HOTKEY)
|
||||
{
|
||||
plugin.setHotKeyPressed(false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == HOTKEY)
|
||||
{
|
||||
plugin.setHotKeyPressed(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,18 +24,19 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.menumodifier;
|
||||
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -43,158 +44,174 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.util.MiscUtils;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Menu Modifier",
|
||||
description = "Changes right click menu for players",
|
||||
tags = { "menu", "modifier", "right", "click", "pk", "bogla" },
|
||||
enabledByDefault = false,
|
||||
type = PluginType.UTILITY
|
||||
name = "Menu Modifier",
|
||||
description = "Changes right click menu for players",
|
||||
tags = {"menu", "modifier", "right", "click", "pk", "bogla"},
|
||||
enabledByDefault = false,
|
||||
type = PluginType.UTILITY
|
||||
)
|
||||
public class MenuModifierPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private MenuModifierConfig config;
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private MenuModifierInputListener inputListener;
|
||||
@Inject
|
||||
private MenuModifierConfig config;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
@Inject
|
||||
private MenuModifierInputListener inputListener;
|
||||
|
||||
@Provides
|
||||
MenuModifierConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(MenuModifierConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
keyManager.registerKeyListener(inputListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hotKeyPressed;
|
||||
@Provides
|
||||
MenuModifierConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(MenuModifierConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOpened(MenuOpened event)
|
||||
{
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
|
||||
if (localPlayer == null)
|
||||
return;
|
||||
|
||||
if (!(MiscUtils.getWildernessLevelFrom(client, localPlayer.getWorldLocation()) >= 0))
|
||||
return;
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
keyManager.registerKeyListener(inputListener);
|
||||
}
|
||||
|
||||
if (hotKeyPressed)
|
||||
return;
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
|
||||
List<MenuEntry> menu_entries = new ArrayList<MenuEntry>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hotKeyPressed;
|
||||
|
||||
for (MenuEntry entry : event.getMenuEntries())
|
||||
{
|
||||
String option = Text.removeTags(entry.getOption()).toLowerCase();
|
||||
@Subscribe
|
||||
public void onMenuOpened(MenuOpened event)
|
||||
{
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
|
||||
if (option.contains("trade with") && config.hideTradeWith())
|
||||
continue;
|
||||
if (localPlayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.contains("lookup") && config.hideLookup())
|
||||
continue;
|
||||
if (!(MiscUtils.getWildernessLevelFrom(client, localPlayer.getWorldLocation()) >= 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.contains("report") && config.hideReport())
|
||||
continue;
|
||||
if (hotKeyPressed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.contains("examine") && config.hideExamine())
|
||||
continue;
|
||||
List<MenuEntry> menu_entries = new ArrayList<>();
|
||||
|
||||
for (MenuEntry entry : event.getMenuEntries())
|
||||
{
|
||||
String option = Text.removeTags(entry.getOption()).toLowerCase();
|
||||
|
||||
if (option.contains("trade with") && config.hideTradeWith())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.contains("lookup") && config.hideLookup())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.contains("report") && config.hideReport())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.contains("examine") && config.hideExamine())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.contains("net") && config.hideNet())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.contains("bait") && config.hideBait())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int identifier = entry.getIdentifier();
|
||||
int identifier = entry.getIdentifier();
|
||||
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
player = players[identifier];
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
{
|
||||
player = players[identifier];
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
menu_entries.add(entry);
|
||||
continue;
|
||||
}
|
||||
if (player == null)
|
||||
{
|
||||
menu_entries.add(entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((option.contains("attack") || option.contains("cast")) && (player.isFriend() || player.isClanMember()))
|
||||
continue;
|
||||
if ((option.contains("attack") || option.contains("cast")) && (player.isFriend() || player.isClanMember()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
menu_entries.add(entry);
|
||||
}
|
||||
menu_entries.add(entry);
|
||||
}
|
||||
|
||||
MenuEntry[] updated_menu_entries = new MenuEntry[menu_entries.size()];
|
||||
updated_menu_entries = menu_entries.toArray(updated_menu_entries);
|
||||
MenuEntry[] updated_menu_entries = new MenuEntry[menu_entries.size()];
|
||||
updated_menu_entries = menu_entries.toArray(updated_menu_entries);
|
||||
|
||||
client.setMenuEntries(updated_menu_entries);
|
||||
}
|
||||
client.setMenuEntries(updated_menu_entries);
|
||||
}
|
||||
|
||||
/*@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
if (true)
|
||||
return;
|
||||
/*@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
if (true)
|
||||
return;
|
||||
|
||||
if (!inWilderness)
|
||||
return;
|
||||
if (!inWilderness)
|
||||
return;
|
||||
|
||||
if (hotKeyPressed)
|
||||
return;
|
||||
|
||||
String option = Text.removeTags(menuEntryAdded.getOption()).toLowerCase();
|
||||
if (hotKeyPressed)
|
||||
return;
|
||||
|
||||
if ((option.contains("trade with") && config.hideTradeWith())
|
||||
|| (option.contains("lookup") && config.hideLookup())
|
||||
|| (option.contains("report") && config.hideReport())
|
||||
|| (option.contains("examine") && config.hideExamine())
|
||||
|| (option.contains("cancel") && config.hideCancel()))
|
||||
{
|
||||
int identifier = menuEntryAdded.getIdentifier();
|
||||
String option = Text.removeTags(menuEntryAdded.getOption()).toLowerCase();
|
||||
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
if ((option.contains("trade with") && config.hideTradeWith())
|
||||
|| (option.contains("lookup") && config.hideLookup())
|
||||
|| (option.contains("report") && config.hideReport())
|
||||
|| (option.contains("examine") && config.hideExamine())
|
||||
|| (option.contains("cancel") && config.hideCancel()))
|
||||
{
|
||||
int identifier = menuEntryAdded.getIdentifier();
|
||||
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
player = players[identifier];
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
player = players[identifier];
|
||||
|
||||
//allow trading with friends/clanmates
|
||||
if (option.contains("trade with") && (player.isFriend() || player.isClanMember()))
|
||||
return;
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
//allow trading with friends/clanmates
|
||||
if (option.contains("trade with") && (player.isFriend() || player.isClanMember()))
|
||||
return;
|
||||
|
||||
if (menuEntries.length > 0)
|
||||
client.setMenuEntries(Arrays.copyOf(menuEntries, menuEntries.length - 1));
|
||||
}
|
||||
}*/
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
|
||||
if (menuEntries.length > 0)
|
||||
client.setMenuEntries(Arrays.copyOf(menuEntries, menuEntries.length - 1));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -24,72 +24,69 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.pluginsorter;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@ConfigGroup("pluginsorter")
|
||||
public interface PluginSorterConfig extends Config {
|
||||
public interface PluginSorterConfig extends Config
|
||||
{
|
||||
boolean pluginsHidden = false;
|
||||
|
||||
Color rlDefault = new Color(250, 155, 23);
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hidePlugins",
|
||||
name = "Hide Plugins",
|
||||
description = "Hides all 3rd party plugins if checked"
|
||||
)
|
||||
default boolean hidePlugins()
|
||||
{
|
||||
return pluginsHidden;
|
||||
}
|
||||
|
||||
boolean pluginsHidden = false;
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "externalColor",
|
||||
name = "External color",
|
||||
description = "Configure the color of external plugins"
|
||||
)
|
||||
default Color externalColor()
|
||||
{
|
||||
return Color.MAGENTA;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hidePlugins",
|
||||
name = "Hide Plugins",
|
||||
description = "Hides all 3rd party plugins if checked"
|
||||
)
|
||||
default boolean hidePlugins()
|
||||
{
|
||||
return pluginsHidden;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "pvmColor",
|
||||
name = "PVM color",
|
||||
description = "Configure the color of PVM related plugins"
|
||||
)
|
||||
default Color pvmColor()
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "externalColor",
|
||||
name = "External color",
|
||||
description = "Configure the color of external plugins"
|
||||
)
|
||||
default Color externalColor()
|
||||
{
|
||||
return Color.MAGENTA;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "pvpColor",
|
||||
name = "PVP color",
|
||||
description = "Configure the color of PVP related plugins"
|
||||
)
|
||||
default Color pvpColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "pvmColor",
|
||||
name = "PVM color",
|
||||
description = "Configure the color of PVM related plugins"
|
||||
)
|
||||
default Color pvmColor()
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "pvpColor",
|
||||
name = "PVP color",
|
||||
description = "Configure the color of PVP related plugins"
|
||||
)
|
||||
default Color pvpColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "utilityColor",
|
||||
name = "Utility color",
|
||||
description = "Configure the color of utility related plugins"
|
||||
)
|
||||
default Color utilityColor()
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "utilityColor",
|
||||
name = "Utility color",
|
||||
description = "Configure the color of utility related plugins"
|
||||
)
|
||||
default Color utilityColor()
|
||||
{
|
||||
return Color.CYAN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,10 +25,14 @@
|
||||
package net.runelite.client.plugins.pluginsorter;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.config.ConfigItemDescriptor;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -37,70 +41,76 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.plugins.config.ConfigPanel;
|
||||
import net.runelite.client.plugins.config.PluginListItem;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Plugin Organizer",
|
||||
description = "Hides and colors 3rd party plugins for better control",
|
||||
tags = {"plugins","organizer"},
|
||||
type = PluginType.PLUGIN_ORGANIZER
|
||||
name = "Plugin Organizer",
|
||||
description = "Hides and colors 3rd party plugins for better control",
|
||||
tags = {"plugins", "organizer"},
|
||||
type = PluginType.PLUGIN_ORGANIZER
|
||||
)
|
||||
public class PluginSorterPlugin extends Plugin {
|
||||
public class PluginSorterPlugin extends Plugin
|
||||
{
|
||||
//Cache the hidden plugins
|
||||
private static List<PluginListItem> removedPlugins = new ArrayList<>();
|
||||
|
||||
//Cache the hidden plugins
|
||||
public static List<PluginListItem> removedPlugins = new ArrayList<>();
|
||||
@Inject
|
||||
private PluginSorterConfig config;
|
||||
|
||||
@Inject
|
||||
private PluginSorterConfig config;
|
||||
@Provides
|
||||
PluginSorterConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PluginSorterConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
PluginSorterConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PluginSorterConfig.class);
|
||||
}
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateColors();
|
||||
}
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
if (config.hidePlugins())
|
||||
{
|
||||
hidePlugins();
|
||||
}
|
||||
updateColors();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged (GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState()== GameState.LOGIN_SCREEN) {
|
||||
if (config.hidePlugins())
|
||||
hidePlugins();
|
||||
updateColors();
|
||||
}
|
||||
}
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if (configChanged.getKey().equals("hidePlugins"))
|
||||
{
|
||||
if (config.hidePlugins())
|
||||
{
|
||||
hidePlugins();
|
||||
}
|
||||
else
|
||||
{
|
||||
showPlugins();
|
||||
}
|
||||
}
|
||||
updateColors();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged) {
|
||||
if (configChanged.getKey().equals("hidePlugins")) {
|
||||
if (config.hidePlugins()) {
|
||||
hidePlugins();
|
||||
} else {
|
||||
showPlugins();
|
||||
}
|
||||
}
|
||||
updateColors();
|
||||
}
|
||||
|
||||
public void updateColors() {
|
||||
for (PluginListItem pli : ConfigPanel.pluginList) {
|
||||
if (pli.getPlugin()!=null) {
|
||||
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type()) {
|
||||
private void updateColors()
|
||||
{
|
||||
for (PluginListItem pli : ConfigPanel.pluginList)
|
||||
{
|
||||
if (pli.getPlugin() != null)
|
||||
{
|
||||
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type())
|
||||
{
|
||||
case EXTERNAL:
|
||||
pli.nameLabel.setForeground(config.externalColor());
|
||||
break;
|
||||
@@ -117,15 +127,18 @@ public class PluginSorterPlugin extends Plugin {
|
||||
pli.nameLabel.setForeground(Color.WHITE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hidePlugins() {
|
||||
Iterator<PluginListItem> iter = ConfigPanel.pluginList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
PluginListItem pli = iter.next();
|
||||
if (pli.getPlugin() != null) {
|
||||
private void hidePlugins()
|
||||
{
|
||||
Iterator<PluginListItem> iter = ConfigPanel.pluginList.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
PluginListItem pli = iter.next();
|
||||
if (pli.getPlugin() != null)
|
||||
{
|
||||
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type())
|
||||
{
|
||||
case PVM:
|
||||
@@ -139,14 +152,15 @@ public class PluginSorterPlugin extends Plugin {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showPlugins() {
|
||||
List<PluginListItem> tempList = new ArrayList<>();
|
||||
private void showPlugins()
|
||||
{
|
||||
List<PluginListItem> tempList = new ArrayList<>();
|
||||
tempList.addAll(removedPlugins);
|
||||
tempList.addAll(ConfigPanel.pluginList);
|
||||
ConfigPanel.pluginList = tempList;
|
||||
}
|
||||
ConfigPanel.pluginList = tempList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,26 +31,34 @@ import net.runelite.api.Player;
|
||||
* When they attacked me
|
||||
* And (in milliseconds) when to expire the overlay around them
|
||||
*/
|
||||
public class PlayerContainer {
|
||||
public class PlayerContainer
|
||||
{
|
||||
|
||||
private Player player;
|
||||
private long whenTheyAttackedMe;
|
||||
private int millisToExpireHighlight;
|
||||
|
||||
public PlayerContainer(Player player, long whenTheyAttackedMe, int millisToExpireHighlight) {
|
||||
PlayerContainer(Player player, long whenTheyAttackedMe, int millisToExpireHighlight)
|
||||
{
|
||||
this.player = player;
|
||||
this.whenTheyAttackedMe = whenTheyAttackedMe;
|
||||
this.millisToExpireHighlight = millisToExpireHighlight;
|
||||
}
|
||||
|
||||
|
||||
//getters
|
||||
public Player getPlayer() {
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
public long getWhenTheyAttackedMe() {
|
||||
|
||||
long getWhenTheyAttackedMe()
|
||||
{
|
||||
return whenTheyAttackedMe;
|
||||
}
|
||||
public int getMillisToExpireHighlight() { return millisToExpireHighlight; };
|
||||
|
||||
int getMillisToExpireHighlight()
|
||||
{
|
||||
return millisToExpireHighlight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,160 +24,209 @@
|
||||
|
||||
package net.runelite.client.plugins.prayagainstplayer;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@ConfigGroup("prayagainstplayer")
|
||||
public interface PrayAgainstPlayerConfig extends Config {
|
||||
public interface PrayAgainstPlayerConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "attackerPlayerColor",
|
||||
name = "Attacker color",
|
||||
description = "This is the color that will be used to highlight attackers."
|
||||
position = 0,
|
||||
keyName = "attackerPlayerColor",
|
||||
name = "Attacker color",
|
||||
description = "This is the color that will be used to highlight attackers."
|
||||
)
|
||||
default Color attackerPlayerColor() { return new Color(0xFF0006); }
|
||||
default Color attackerPlayerColor()
|
||||
{
|
||||
return new Color(0xFF0006);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "potentialPlayerColor",
|
||||
name = "Potential Attacker color",
|
||||
description = "This is the color that will be used to highlight potential attackers."
|
||||
position = 1,
|
||||
keyName = "potentialPlayerColor",
|
||||
name = "Potential Attacker color",
|
||||
description = "This is the color that will be used to highlight potential attackers."
|
||||
)
|
||||
default Color potentialPlayerColor() { return new Color(0xFFFF00); }
|
||||
|
||||
////
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "attackerTargetTimeout",
|
||||
name = "Attacker Timeout",
|
||||
description = "Seconds until attacker is no longer highlighted."
|
||||
)
|
||||
default int attackerTargetTimeout() { return 10; }
|
||||
default Color potentialPlayerColor()
|
||||
{
|
||||
return new Color(0xFFFF00);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "potentialTargetTimeout",
|
||||
name = "Potential Attacker Timeout",
|
||||
description = "Seconds until potential attacker is no longer highlighted."
|
||||
position = 2,
|
||||
keyName = "attackerTargetTimeout",
|
||||
name = "Attacker Timeout",
|
||||
description = "Seconds until attacker is no longer highlighted."
|
||||
)
|
||||
default int potentialTargetTimeout() { return 10; }
|
||||
default int attackerTargetTimeout()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "newSpawnTimeout",
|
||||
name = "New Player Timeout",
|
||||
description = "Seconds until logged in/spawned player is no longer highlighted."
|
||||
position = 3,
|
||||
keyName = "potentialTargetTimeout",
|
||||
name = "Potential Attacker Timeout",
|
||||
description = "Seconds until potential attacker is no longer highlighted."
|
||||
)
|
||||
default int newSpawnTimeout() { return 5; }
|
||||
////
|
||||
|
||||
////
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "ignoreFriends",
|
||||
name = "Ignore Friends",
|
||||
description = "This lets you decide whether you want friends to be highlighted by this plugin."
|
||||
)
|
||||
default boolean ignoreFriends() { return true; }
|
||||
default int potentialTargetTimeout()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "ignoreClanMates",
|
||||
name = "Ignore Clan Mates",
|
||||
description = "This lets you decide whether you want clan mates to be highlighted by this plugin."
|
||||
position = 4,
|
||||
keyName = "newSpawnTimeout",
|
||||
name = "New Player Timeout",
|
||||
description = "Seconds until logged in/spawned player is no longer highlighted."
|
||||
)
|
||||
default boolean ignoreClanMates() { return true; }
|
||||
////
|
||||
default int newSpawnTimeout()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "markNewPlayer",
|
||||
name = "Mark new player as potential attacker",
|
||||
description = "Marks someone that logged in or teleported as a potential attacker for your safety\nDO NOT RUN THIS IN WORLD 1-2 GRAND EXCHANGE!"
|
||||
position = 5,
|
||||
keyName = "ignoreFriends",
|
||||
name = "Ignore Friends",
|
||||
description = "This lets you decide whether you want friends to be highlighted by this plugin."
|
||||
)
|
||||
default boolean markNewPlayer() { return false; }
|
||||
default boolean ignoreFriends()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "drawTargetPrayAgainst",
|
||||
name = "Draw what to pray on attacker",
|
||||
description = "Tells you what to pray from what weapon the attacker is holding"
|
||||
position = 6,
|
||||
keyName = "ignoreClanMates",
|
||||
name = "Ignore Clan Mates",
|
||||
description = "This lets you decide whether you want clan mates to be highlighted by this plugin."
|
||||
)
|
||||
default boolean drawTargetPrayAgainst() { return true; }
|
||||
default boolean ignoreClanMates()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "drawPotentialTargetPrayAgainst",
|
||||
name = "Draw what to pray on potential attacker",
|
||||
description = "Tells you what to pray from what weapon the potential attacker is holding"
|
||||
position = 7,
|
||||
keyName = "markNewPlayer",
|
||||
name = "Mark new player as potential attacker",
|
||||
description = "Marks someone that logged in or teleported as a potential attacker for your safety\nDO NOT RUN THIS IN WORLD 1-2 GRAND EXCHANGE!"
|
||||
)
|
||||
default boolean drawPotentialTargetPrayAgainst() { return true; }
|
||||
default boolean markNewPlayer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "drawTargetPrayAgainstPrayerTab",
|
||||
name = "Draw what to pray from prayer tab",
|
||||
description = "Tells you what to pray from what weapon the attacker is holding from the prayer tab"
|
||||
position = 8,
|
||||
keyName = "drawTargetPrayAgainst",
|
||||
name = "Draw what to pray on attacker",
|
||||
description = "Tells you what to pray from what weapon the attacker is holding"
|
||||
)
|
||||
default boolean drawTargetPrayAgainstPrayerTab() { return false; }
|
||||
default boolean drawTargetPrayAgainst()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "drawTargetsName",
|
||||
name = "Draw name on attacker",
|
||||
description = "Configures whether or not the attacker\'s name should be shown"
|
||||
position = 9,
|
||||
keyName = "drawPotentialTargetPrayAgainst",
|
||||
name = "Draw what to pray on potential attacker",
|
||||
description = "Tells you what to pray from what weapon the potential attacker is holding"
|
||||
)
|
||||
default boolean drawTargetsName() { return true; }
|
||||
default boolean drawPotentialTargetPrayAgainst()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "drawPotentialTargetsName",
|
||||
name = "Draw name on potential attacker",
|
||||
description = "Configures whether or not the potential attacker\'s name should be shown"
|
||||
position = 10,
|
||||
keyName = "drawTargetPrayAgainstPrayerTab",
|
||||
name = "Draw what to pray from prayer tab",
|
||||
description = "Tells you what to pray from what weapon the attacker is holding from the prayer tab"
|
||||
)
|
||||
default boolean drawPotentialTargetsName() { return true; }
|
||||
default boolean drawTargetPrayAgainstPrayerTab()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "drawTargetHighlight",
|
||||
name = "Draw highlight around attacker",
|
||||
description = "Configures whether or not the attacker should be highlighted"
|
||||
position = 11,
|
||||
keyName = "drawTargetsName",
|
||||
name = "Draw name on attacker",
|
||||
description = "Configures whether or not the attacker\'s name should be shown"
|
||||
)
|
||||
default boolean drawTargetHighlight() { return true; }
|
||||
default boolean drawTargetsName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "drawPotentialTargetHighlight",
|
||||
name = "Draw highlight around potential attacker",
|
||||
description = "Configures whether or not the potential attacker should be highlighted"
|
||||
position = 12,
|
||||
keyName = "drawPotentialTargetsName",
|
||||
name = "Draw name on potential attacker",
|
||||
description = "Configures whether or not the potential attacker\'s name should be shown"
|
||||
)
|
||||
default boolean drawPotentialTargetHighlight() { return true; }
|
||||
default boolean drawPotentialTargetsName()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
keyName = "drawTargetTile",
|
||||
name = "Draw tile under attacker",
|
||||
description = "Configures whether or not the attacker\'s tile be highlighted"
|
||||
position = 13,
|
||||
keyName = "drawTargetHighlight",
|
||||
name = "Draw highlight around attacker",
|
||||
description = "Configures whether or not the attacker should be highlighted"
|
||||
)
|
||||
default boolean drawTargetTile() { return false; }
|
||||
default boolean drawTargetHighlight()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
keyName = "drawPotentialTargetTile",
|
||||
name = "Draw tile under potential attacker",
|
||||
description = "Configures whether or not the potential attacker\'s tile be highlighted"
|
||||
position = 14,
|
||||
keyName = "drawPotentialTargetHighlight",
|
||||
name = "Draw highlight around potential attacker",
|
||||
description = "Configures whether or not the potential attacker should be highlighted"
|
||||
)
|
||||
default boolean drawPotentialTargetTile() { return false; }
|
||||
default boolean drawPotentialTargetHighlight()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 17,
|
||||
keyName = "drawUnknownWeapons",
|
||||
name = "Draw unknown weapons",
|
||||
description = "Configures whether or not the unknown weapons should be shown when a player equips one"
|
||||
position = 15,
|
||||
keyName = "drawTargetTile",
|
||||
name = "Draw tile under attacker",
|
||||
description = "Configures whether or not the attacker\'s tile be highlighted"
|
||||
)
|
||||
default boolean drawUnknownWeapons() { return false; }
|
||||
default boolean drawTargetTile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
keyName = "drawPotentialTargetTile",
|
||||
name = "Draw tile under potential attacker",
|
||||
description = "Configures whether or not the potential attacker\'s tile be highlighted"
|
||||
)
|
||||
default boolean drawPotentialTargetTile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 17,
|
||||
keyName = "drawUnknownWeapons",
|
||||
name = "Draw unknown weapons",
|
||||
description = "Configures whether or not the unknown weapons should be shown when a player equips one"
|
||||
)
|
||||
default boolean drawUnknownWeapons()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,27 +24,35 @@
|
||||
|
||||
package net.runelite.client.plugins.prayagainstplayer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
class PrayAgainstPlayerOverlay extends Overlay {
|
||||
class PrayAgainstPlayerOverlay extends Overlay
|
||||
{
|
||||
|
||||
private final PrayAgainstPlayerPlugin plugin;
|
||||
private final PrayAgainstPlayerConfig config;
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
private PrayAgainstPlayerOverlay(PrayAgainstPlayerPlugin plugin, PrayAgainstPlayerConfig config, Client client) {
|
||||
private PrayAgainstPlayerOverlay(PrayAgainstPlayerPlugin plugin, PrayAgainstPlayerConfig config, Client client)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
@@ -57,73 +65,127 @@ class PrayAgainstPlayerOverlay extends Overlay {
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
renderPotentialPlayers(graphics);
|
||||
renderAttackingPlayers(graphics);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPotentialPlayers(Graphics2D graphics) {
|
||||
if (plugin.getPotentialPlayersAttackingMe() == null || !plugin.getPotentialPlayersAttackingMe().isEmpty()) {
|
||||
try {
|
||||
for (PlayerContainer container : plugin.getPotentialPlayersAttackingMe()) {
|
||||
if ((System.currentTimeMillis() > (container.getWhenTheyAttackedMe() + container.getMillisToExpireHighlight())) && (container.getPlayer().getInteracting() != client.getLocalPlayer())) {
|
||||
plugin.removePlayerFromPotentialContainer(container);
|
||||
private void renderPotentialPlayers(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.getPotentialPlayersAttackingMe() == null || !plugin.getPotentialPlayersAttackingMe().isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (plugin.getPotentialPlayersAttackingMe() != null)
|
||||
{
|
||||
for (PlayerContainer container : plugin.getPotentialPlayersAttackingMe())
|
||||
{
|
||||
if ((System.currentTimeMillis() > (container.getWhenTheyAttackedMe() + container.getMillisToExpireHighlight())) && (container.getPlayer().getInteracting() != client.getLocalPlayer()))
|
||||
{
|
||||
plugin.removePlayerFromPotentialContainer(container);
|
||||
}
|
||||
if (config.drawPotentialTargetsName())
|
||||
{
|
||||
renderNameAboveHead(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
}
|
||||
if (config.drawPotentialTargetHighlight())
|
||||
{
|
||||
renderHighlightedPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
}
|
||||
if (config.drawPotentialTargetTile())
|
||||
{
|
||||
renderTileUnderPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
}
|
||||
if (config.drawPotentialTargetPrayAgainst())
|
||||
{
|
||||
renderPrayAgainstOnPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
}
|
||||
}
|
||||
if (config.drawPotentialTargetsName()) renderNameAboveHead(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
if (config.drawPotentialTargetHighlight()) renderHighlightedPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
if (config.drawPotentialTargetTile()) renderTileUnderPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
if (config.drawPotentialTargetPrayAgainst()) renderPrayAgainstOnPlayer(graphics, container.getPlayer(), config.potentialPlayerColor());
|
||||
}
|
||||
} catch (ConcurrentModificationException e) {
|
||||
}
|
||||
catch (ConcurrentModificationException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderAttackingPlayers(Graphics2D graphics) {
|
||||
if (plugin.getPlayersAttackingMe() == null || !plugin.getPlayersAttackingMe().isEmpty()) {
|
||||
try {
|
||||
for (PlayerContainer container : plugin.getPlayersAttackingMe()) {
|
||||
if ((System.currentTimeMillis() > (container.getWhenTheyAttackedMe() + container.getMillisToExpireHighlight())) && (container.getPlayer().getInteracting() != client.getLocalPlayer())) {
|
||||
plugin.removePlayerFromAttackerContainer(container);
|
||||
}
|
||||
private void renderAttackingPlayers(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.getPlayersAttackingMe() == null || !plugin.getPlayersAttackingMe().isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (plugin.getPlayersAttackingMe() != null)
|
||||
{
|
||||
for (PlayerContainer container : plugin.getPlayersAttackingMe())
|
||||
{
|
||||
if ((System.currentTimeMillis() > (container.getWhenTheyAttackedMe() + container.getMillisToExpireHighlight())) && (container.getPlayer().getInteracting() != client.getLocalPlayer()))
|
||||
{
|
||||
plugin.removePlayerFromAttackerContainer(container);
|
||||
}
|
||||
|
||||
if (config.drawTargetsName()) renderNameAboveHead(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
if (config.drawTargetHighlight()) renderHighlightedPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
if (config.drawTargetTile()) renderTileUnderPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
if (config.drawTargetPrayAgainst()) renderPrayAgainstOnPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
if (config.drawTargetsName())
|
||||
{
|
||||
renderNameAboveHead(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
}
|
||||
if (config.drawTargetHighlight())
|
||||
{
|
||||
renderHighlightedPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
}
|
||||
if (config.drawTargetTile())
|
||||
{
|
||||
renderTileUnderPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
}
|
||||
if (config.drawTargetPrayAgainst())
|
||||
{
|
||||
renderPrayAgainstOnPlayer(graphics, container.getPlayer(), config.attackerPlayerColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ConcurrentModificationException e) {
|
||||
}
|
||||
catch (ConcurrentModificationException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderNameAboveHead(Graphics2D graphics, Player player, Color color) {
|
||||
private void renderNameAboveHead(Graphics2D graphics, Player player, Color color)
|
||||
{
|
||||
final String name = Text.sanitize(player.getName());
|
||||
final int offset = player.getLogicalHeight() + 40;
|
||||
Point textLocation = player.getCanvasTextLocation(graphics, name, offset);
|
||||
if (textLocation != null) {
|
||||
if (textLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderHighlightedPlayer(Graphics2D graphics, Player player, Color color) {
|
||||
try {
|
||||
private void renderHighlightedPlayer(Graphics2D graphics, Player player, Color color)
|
||||
{
|
||||
try
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, player.getConvexHull(), color);
|
||||
} catch (NullPointerException e) {
|
||||
}
|
||||
catch (NullPointerException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTileUnderPlayer(Graphics2D graphics, Player player, Color color) {
|
||||
private void renderTileUnderPlayer(Graphics2D graphics, Player player, Color color)
|
||||
{
|
||||
Polygon poly = player.getCanvasTilePoly();
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
private void renderPrayAgainstOnPlayer(Graphics2D graphics, Player player, Color color) {
|
||||
private void renderPrayAgainstOnPlayer(Graphics2D graphics, Player player, Color color)
|
||||
{
|
||||
final int offset = (player.getLogicalHeight() / 2) + 75;
|
||||
BufferedImage icon;
|
||||
|
||||
switch (WeaponType.checkWeaponOnPlayer(client, player)) {
|
||||
switch (WeaponType.checkWeaponOnPlayer(client, player))
|
||||
{
|
||||
case WEAPON_MELEE:
|
||||
icon = plugin.getProtectionIcon(WeaponType.WEAPON_MELEE);
|
||||
break;
|
||||
@@ -137,12 +199,17 @@ class PrayAgainstPlayerOverlay extends Overlay {
|
||||
icon = null;
|
||||
break;
|
||||
}
|
||||
try {
|
||||
if (icon != null) {
|
||||
try
|
||||
{
|
||||
if (icon != null)
|
||||
{
|
||||
Point point = player.getCanvasImageLocation(icon, offset);
|
||||
OverlayUtil.renderImageLocation(graphics, point, icon);
|
||||
} else {
|
||||
if (config.drawUnknownWeapons()) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config.drawUnknownWeapons())
|
||||
{
|
||||
int itemId = player.getPlayerComposition().getEquipmentId(KitType.WEAPON);
|
||||
ItemComposition itemComposition = client.getItemDefinition(itemId);
|
||||
|
||||
@@ -151,7 +218,9 @@ class PrayAgainstPlayerOverlay extends Overlay {
|
||||
OverlayUtil.renderTextLocation(graphics, point, str, color);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,24 +24,33 @@
|
||||
|
||||
package net.runelite.client.plugins.prayagainstplayer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
class PrayAgainstPlayerOverlayPrayerTab extends Overlay {
|
||||
class PrayAgainstPlayerOverlayPrayerTab extends Overlay
|
||||
{
|
||||
|
||||
private final PrayAgainstPlayerPlugin plugin;
|
||||
private final PrayAgainstPlayerConfig config;
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
private PrayAgainstPlayerOverlayPrayerTab (PrayAgainstPlayerPlugin plugin, PrayAgainstPlayerConfig config, Client client) {
|
||||
private PrayAgainstPlayerOverlayPrayerTab(PrayAgainstPlayerPlugin plugin, PrayAgainstPlayerConfig config, Client client)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
@@ -54,30 +63,46 @@ class PrayAgainstPlayerOverlayPrayerTab extends Overlay {
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (plugin.getPlayersAttackingMe() == null || !plugin.getPlayersAttackingMe().isEmpty()) {
|
||||
try {
|
||||
for (PlayerContainer container : plugin.getPlayersAttackingMe()) {
|
||||
if (plugin.getPlayersAttackingMe() != null && plugin.getPlayersAttackingMe().size() > 0) {
|
||||
//no reason to show you what prayers to pray in your prayer tab if multiple people are attacking you
|
||||
if ((plugin.getPlayersAttackingMe().size() == 1) && (config.drawTargetPrayAgainstPrayerTab())) {
|
||||
renderPrayerToClick(graphics, container.getPlayer());
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.getPlayersAttackingMe() == null || !plugin.getPlayersAttackingMe().isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (plugin.getPlayersAttackingMe() != null)
|
||||
{
|
||||
for (PlayerContainer container : plugin.getPlayersAttackingMe())
|
||||
{
|
||||
if (plugin.getPlayersAttackingMe() != null && plugin.getPlayersAttackingMe().size() > 0)
|
||||
{
|
||||
// no reason to show you what prayers to pray in your prayer tab if multiple people are attacking you
|
||||
if ((plugin.getPlayersAttackingMe().size() == 1) && (config.drawTargetPrayAgainstPrayerTab()))
|
||||
{
|
||||
renderPrayerToClick(graphics, container.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ConcurrentModificationException e) {
|
||||
}
|
||||
catch (ConcurrentModificationException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPrayerToClick(Graphics2D graphics, Player player) {
|
||||
private void renderPrayerToClick(Graphics2D graphics, Player player)
|
||||
{
|
||||
Widget PROTECT_FROM_MAGIC = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MAGIC);
|
||||
Widget PROTECT_FROM_RANGED = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MISSILES);
|
||||
Widget PROTECT_FROM_MELEE = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MELEE);
|
||||
Color color = Color.RED;
|
||||
if (PROTECT_FROM_MELEE.isHidden()) return;
|
||||
switch (WeaponType.checkWeaponOnPlayer(client, player)) {
|
||||
if (PROTECT_FROM_MELEE.isHidden())
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (WeaponType.checkWeaponOnPlayer(client, player))
|
||||
{
|
||||
case WEAPON_MAGIC:
|
||||
OverlayUtil.renderPolygon(graphics, rectangleToPolygon(PROTECT_FROM_MAGIC.getBounds()), color);
|
||||
break;
|
||||
@@ -92,9 +117,11 @@ class PrayAgainstPlayerOverlayPrayerTab extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
private static Polygon rectangleToPolygon(Rectangle rect) {
|
||||
private static Polygon rectangleToPolygon(Rectangle rect)
|
||||
{
|
||||
int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x};
|
||||
int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height};
|
||||
|
||||
return new Polygon(xpoints, ypoints, 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,27 @@
|
||||
package net.runelite.client.plugins.prayagainstplayer;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBufferByte;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.IndexedSprite;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.InteractingChanged;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
@@ -36,33 +55,29 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Pray Against Player",
|
||||
description = "Use plugin in PvP situations for best results!!",
|
||||
tags = {"highlight", "pvp", "overlay", "players"},
|
||||
type = PluginType.PVP
|
||||
name = "Pray Against Player",
|
||||
description = "Use plugin in PvP situations for best results!!",
|
||||
tags = {"highlight", "pvp", "overlay", "players"},
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
/**
|
||||
* I am fully aware that there is plenty of overhead and is a MESS!
|
||||
* If you'd like to contribute please do!
|
||||
*/
|
||||
public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
public class PrayAgainstPlayerPlugin extends Plugin
|
||||
{
|
||||
|
||||
private static final int[] PROTECTION_ICONS = {
|
||||
SpriteID.PRAYER_PROTECT_FROM_MISSILES,
|
||||
SpriteID.PRAYER_PROTECT_FROM_MELEE,
|
||||
SpriteID.PRAYER_PROTECT_FROM_MAGIC
|
||||
SpriteID.PRAYER_PROTECT_FROM_MISSILES,
|
||||
SpriteID.PRAYER_PROTECT_FROM_MELEE,
|
||||
SpriteID.PRAYER_PROTECT_FROM_MAGIC
|
||||
};
|
||||
private static final Dimension PROTECTION_ICON_DIMENSION = new Dimension(33, 33);
|
||||
private static final Color PROTECTION_ICON_OUTLINE_COLOR = new Color(33, 33, 33);
|
||||
public final BufferedImage[] ProtectionIcons = new BufferedImage[PROTECTION_ICONS.length];
|
||||
private final BufferedImage[] ProtectionIcons = new BufferedImage[PROTECTION_ICONS.length];
|
||||
|
||||
private ArrayList<PlayerContainer> potentialPlayersAttackingMe;
|
||||
private ArrayList<PlayerContainer> playersAttackingMe;
|
||||
@@ -86,19 +101,23 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
private PrayAgainstPlayerConfig config;
|
||||
|
||||
@Provides
|
||||
PrayAgainstPlayerConfig provideConfig(ConfigManager configManager) {
|
||||
PrayAgainstPlayerConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PrayAgainstPlayerConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.LOGGED_IN) {
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
loadProtectionIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() {
|
||||
protected void startUp()
|
||||
{
|
||||
potentialPlayersAttackingMe = new ArrayList<>();
|
||||
playersAttackingMe = new ArrayList<>();
|
||||
overlayManager.add(overlay);
|
||||
@@ -106,31 +125,44 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(overlayPrayerTab);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onAnimationChanged(AnimationChanged animationChanged) {
|
||||
if ((animationChanged.getActor() instanceof Player) && (animationChanged.getActor().getInteracting() instanceof Player) && (animationChanged.getActor().getInteracting() == client.getLocalPlayer())) {
|
||||
protected void onAnimationChanged(AnimationChanged animationChanged)
|
||||
{
|
||||
if ((animationChanged.getActor() instanceof Player) && (animationChanged.getActor().getInteracting() instanceof Player) && (animationChanged.getActor().getInteracting() == client.getLocalPlayer()))
|
||||
{
|
||||
Player sourcePlayer = (Player) animationChanged.getActor();
|
||||
|
||||
//is the client is a friend/clan and the config is set to ignore friends/clan dont add them to list
|
||||
if (client.isFriended(sourcePlayer.getName(), true) && config.ignoreFriends()) return;
|
||||
if (client.isClanMember(sourcePlayer.getName()) && config.ignoreClanMates()) return;
|
||||
// is the client is a friend/clan and the config is set to ignore friends/clan dont add them to list
|
||||
if (client.isFriended(sourcePlayer.getName(), true) && config.ignoreFriends())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (client.isClanMember(sourcePlayer.getName()) && config.ignoreClanMates())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((sourcePlayer.getAnimation() != -1) && (!isBlockAnimation(sourcePlayer.getAnimation()))) {
|
||||
//if attacker attacks again, reset his timer so overlay doesn't go away
|
||||
if (findPlayerInAttackerList(sourcePlayer) != null) {
|
||||
if ((sourcePlayer.getAnimation() != -1) && (!isBlockAnimation(sourcePlayer.getAnimation())))
|
||||
{
|
||||
// if attacker attacks again, reset his timer so overlay doesn't go away
|
||||
if (findPlayerInAttackerList(sourcePlayer) != null)
|
||||
{
|
||||
resetPlayerFromAttackerContainerTimer(findPlayerInAttackerList(sourcePlayer));
|
||||
}
|
||||
//if he attacks and he was in the potential attackers list, remove him
|
||||
if (!potentialPlayersAttackingMe.isEmpty() && potentialPlayersAttackingMe.contains(findPlayerInPotentialList(sourcePlayer))) {
|
||||
// if he attacks and he was in the potential attackers list, remove him
|
||||
if (!potentialPlayersAttackingMe.isEmpty() && potentialPlayersAttackingMe.contains(findPlayerInPotentialList(sourcePlayer)))
|
||||
{
|
||||
removePlayerFromPotentialContainer(findPlayerInPotentialList(sourcePlayer));
|
||||
}
|
||||
//if he's not in the attackers list, add him
|
||||
if (findPlayerInAttackerList(sourcePlayer) == null) {
|
||||
// if he's not in the attackers list, add him
|
||||
if (findPlayerInAttackerList(sourcePlayer) == null)
|
||||
{
|
||||
PlayerContainer container = new PlayerContainer(sourcePlayer, System.currentTimeMillis(), (config.attackerTargetTimeout() * 1000));
|
||||
playersAttackingMe.add(container);
|
||||
}
|
||||
@@ -139,16 +171,25 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onInteractingChanged(InteractingChanged interactingChanged) {
|
||||
//if someone interacts with you, add them to the potential attackers list
|
||||
if ((interactingChanged.getSource() instanceof Player) && (interactingChanged.getTarget() instanceof Player)) {
|
||||
protected void onInteractingChanged(InteractingChanged interactingChanged)
|
||||
{
|
||||
// if someone interacts with you, add them to the potential attackers list
|
||||
if ((interactingChanged.getSource() instanceof Player) && (interactingChanged.getTarget() instanceof Player))
|
||||
{
|
||||
Player sourcePlayer = (Player) interactingChanged.getSource();
|
||||
Player targetPlayer = (Player) interactingChanged.getTarget();
|
||||
if ((targetPlayer == client.getLocalPlayer()) && (findPlayerInPotentialList(sourcePlayer) == null)) { //we're being interacted with
|
||||
if ((targetPlayer == client.getLocalPlayer()) && (findPlayerInPotentialList(sourcePlayer) == null))
|
||||
{ //we're being interacted with
|
||||
|
||||
//is the client is a friend/clan and the config is set to ignore friends/clan dont add them to list
|
||||
if (client.isFriended(sourcePlayer.getName(), true) && config.ignoreFriends()) return;
|
||||
if (client.isClanMember(sourcePlayer.getName()) && config.ignoreClanMates()) return;
|
||||
// is the client is a friend/clan and the config is set to ignore friends/clan dont add them to list
|
||||
if (client.isFriended(sourcePlayer.getName(), true) && config.ignoreFriends())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (client.isClanMember(sourcePlayer.getName()) && config.ignoreClanMates())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerContainer container = new PlayerContainer(sourcePlayer, System.currentTimeMillis(), (config.potentialTargetTimeout() * 1000));
|
||||
potentialPlayersAttackingMe.add(container);
|
||||
@@ -157,53 +198,71 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onPlayerDespawned(PlayerDespawned playerDespawned) {
|
||||
protected void onPlayerDespawned(PlayerDespawned playerDespawned)
|
||||
{
|
||||
PlayerContainer container = findPlayerInAttackerList(playerDespawned.getPlayer());
|
||||
PlayerContainer container2 = findPlayerInPotentialList(playerDespawned.getPlayer());
|
||||
if (container != null) {
|
||||
if (container != null)
|
||||
{
|
||||
playersAttackingMe.remove(container);
|
||||
}
|
||||
if (container2 != null) {
|
||||
if (container2 != null)
|
||||
{
|
||||
potentialPlayersAttackingMe.remove(container2);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onPlayerSpawned(PlayerSpawned playerSpawned) {
|
||||
if (config.markNewPlayer()) {
|
||||
protected void onPlayerSpawned(PlayerSpawned playerSpawned)
|
||||
{
|
||||
if (config.markNewPlayer())
|
||||
{
|
||||
Player p = playerSpawned.getPlayer();
|
||||
|
||||
if (client.isFriended(p.getName(), true) && config.ignoreFriends()) return;
|
||||
if (client.isClanMember(p.getName()) && config.ignoreClanMates()) return;
|
||||
if (client.isFriended(p.getName(), true) && config.ignoreFriends())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (client.isClanMember(p.getName()) && config.ignoreClanMates())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerContainer container = findPlayerInPotentialList(p);
|
||||
if (container == null) {
|
||||
if (container == null)
|
||||
{
|
||||
container = new PlayerContainer(p, System.currentTimeMillis(), (config.newSpawnTimeout() * 1000));
|
||||
potentialPlayersAttackingMe.add(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlayerContainer findPlayerInAttackerList(Player player) {
|
||||
if (playersAttackingMe.isEmpty()) {
|
||||
private PlayerContainer findPlayerInAttackerList(Player player)
|
||||
{
|
||||
if (playersAttackingMe.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int i = 0 ; i < playersAttackingMe.size() ; i++) {
|
||||
PlayerContainer container = playersAttackingMe.get(i);
|
||||
if (container.getPlayer() == player) {
|
||||
for (PlayerContainer container : playersAttackingMe)
|
||||
{
|
||||
if (container.getPlayer() == player)
|
||||
{
|
||||
return container;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PlayerContainer findPlayerInPotentialList(Player player) {
|
||||
if (potentialPlayersAttackingMe.isEmpty()) {
|
||||
private PlayerContainer findPlayerInPotentialList(Player player)
|
||||
{
|
||||
if (potentialPlayersAttackingMe.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (int i = 0 ; i < potentialPlayersAttackingMe.size() ; i++) {
|
||||
PlayerContainer container = potentialPlayersAttackingMe.get(i);
|
||||
if (container.getPlayer() == player) {
|
||||
for (PlayerContainer container : potentialPlayersAttackingMe)
|
||||
{
|
||||
if (container.getPlayer() == player)
|
||||
{
|
||||
return container;
|
||||
}
|
||||
}
|
||||
@@ -212,29 +271,36 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
|
||||
/**
|
||||
* Resets player timer in case he attacks again, so his highlight doesn't go away so easily
|
||||
*
|
||||
* @param container
|
||||
*/
|
||||
public void resetPlayerFromAttackerContainerTimer(PlayerContainer container) {
|
||||
private void resetPlayerFromAttackerContainerTimer(PlayerContainer container)
|
||||
{
|
||||
removePlayerFromAttackerContainer(container);
|
||||
PlayerContainer newContainer = new PlayerContainer(container.getPlayer(), System.currentTimeMillis(), (config.attackerTargetTimeout() * 1000));
|
||||
playersAttackingMe.add(newContainer);
|
||||
}
|
||||
|
||||
|
||||
public void removePlayerFromPotentialContainer(PlayerContainer container) {
|
||||
if ((potentialPlayersAttackingMe != null) && (!potentialPlayersAttackingMe.isEmpty()) && (potentialPlayersAttackingMe.contains(container))) {
|
||||
void removePlayerFromPotentialContainer(PlayerContainer container)
|
||||
{
|
||||
if ((potentialPlayersAttackingMe != null) && (!potentialPlayersAttackingMe.isEmpty()))
|
||||
{
|
||||
potentialPlayersAttackingMe.remove(container);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayerFromAttackerContainer(PlayerContainer container) {
|
||||
if ((playersAttackingMe != null) && (!playersAttackingMe.isEmpty()) && (playersAttackingMe.contains(container))) {
|
||||
void removePlayerFromAttackerContainer(PlayerContainer container)
|
||||
{
|
||||
if ((playersAttackingMe != null) && (!playersAttackingMe.isEmpty()))
|
||||
{
|
||||
playersAttackingMe.remove(container);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBlockAnimation(int anim) {
|
||||
switch (anim) {
|
||||
private boolean isBlockAnimation(int anim)
|
||||
{
|
||||
switch (anim)
|
||||
{
|
||||
case AnimationID.BLOCK_DEFENDER:
|
||||
case AnimationID.BLOCK_NO_SHIELD:
|
||||
case AnimationID.BLOCK_SHIELD:
|
||||
@@ -246,49 +312,34 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<PlayerContainer> getPotentialPlayersAttackingMe() { return potentialPlayersAttackingMe; }
|
||||
public ArrayList<PlayerContainer> getPlayersAttackingMe() { return playersAttackingMe; }
|
||||
ArrayList<PlayerContainer> getPotentialPlayersAttackingMe()
|
||||
{
|
||||
return potentialPlayersAttackingMe;
|
||||
}
|
||||
|
||||
ArrayList<PlayerContainer> getPlayersAttackingMe()
|
||||
{
|
||||
return playersAttackingMe;
|
||||
}
|
||||
|
||||
//All of the methods below are from the Zulrah plugin!!! Credits to it's respective owner
|
||||
private void loadProtectionIcons() {
|
||||
final IndexedSprite[] protectionIcons = {};
|
||||
final IndexedSprite[] newProtectionIcons = Arrays.copyOf(protectionIcons, PROTECTION_ICONS.length);
|
||||
private void loadProtectionIcons()
|
||||
{
|
||||
int curPosition = 0;
|
||||
|
||||
for (int i = 0; i < PROTECTION_ICONS.length; i++, curPosition++)
|
||||
{
|
||||
final int resource = PROTECTION_ICONS[i];
|
||||
ProtectionIcons[i] = rgbaToIndexedBufferedImage(ProtectionIconFromSprite(spriteManager.getSprite(resource, 0)));
|
||||
newProtectionIcons[curPosition] = createIndexedSprite(client, ProtectionIcons[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private static IndexedSprite createIndexedSprite(final Client client, final BufferedImage bufferedImage) {
|
||||
final IndexColorModel indexedCM = (IndexColorModel) bufferedImage.getColorModel();
|
||||
|
||||
final int width = bufferedImage.getWidth();
|
||||
final int height = bufferedImage.getHeight();
|
||||
final byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
|
||||
final int[] palette = new int[indexedCM.getMapSize()];
|
||||
indexedCM.getRGBs(palette);
|
||||
|
||||
final IndexedSprite newIndexedSprite = client.createIndexedSprite();
|
||||
newIndexedSprite.setPixels(pixels);
|
||||
newIndexedSprite.setPalette(palette);
|
||||
newIndexedSprite.setWidth(width);
|
||||
newIndexedSprite.setHeight(height);
|
||||
newIndexedSprite.setOriginalWidth(width);
|
||||
newIndexedSprite.setOriginalHeight(height);
|
||||
newIndexedSprite.setOffsetX(0);
|
||||
newIndexedSprite.setOffsetY(0);
|
||||
return newIndexedSprite;
|
||||
}
|
||||
|
||||
private static BufferedImage rgbaToIndexedBufferedImage(final BufferedImage sourceBufferedImage) {
|
||||
private static BufferedImage rgbaToIndexedBufferedImage(final BufferedImage sourceBufferedImage)
|
||||
{
|
||||
final BufferedImage indexedImage = new BufferedImage(
|
||||
sourceBufferedImage.getWidth(),
|
||||
sourceBufferedImage.getHeight(),
|
||||
BufferedImage.TYPE_BYTE_INDEXED);
|
||||
sourceBufferedImage.getWidth(),
|
||||
sourceBufferedImage.getHeight(),
|
||||
BufferedImage.TYPE_BYTE_INDEXED);
|
||||
|
||||
final ColorModel cm = indexedImage.getColorModel();
|
||||
final IndexColorModel icm = (IndexColorModel) cm;
|
||||
@@ -309,13 +360,16 @@ public class PrayAgainstPlayerPlugin extends Plugin {
|
||||
return resultIndexedImage;
|
||||
}
|
||||
|
||||
private static BufferedImage ProtectionIconFromSprite(final BufferedImage freezeSprite) {
|
||||
private static BufferedImage ProtectionIconFromSprite(final BufferedImage freezeSprite)
|
||||
{
|
||||
final BufferedImage freezeCanvas = ImageUtil.resizeCanvas(freezeSprite, PROTECTION_ICON_DIMENSION.width, PROTECTION_ICON_DIMENSION.height);
|
||||
return ImageUtil.outlineImage(freezeCanvas, PROTECTION_ICON_OUTLINE_COLOR);
|
||||
}
|
||||
|
||||
BufferedImage getProtectionIcon(WeaponType weaponType) {
|
||||
switch (weaponType) {
|
||||
BufferedImage getProtectionIcon(WeaponType weaponType)
|
||||
{
|
||||
switch (weaponType)
|
||||
{
|
||||
case WEAPON_RANGED:
|
||||
return ProtectionIcons[0];
|
||||
case WEAPON_MELEE:
|
||||
|
||||
@@ -23,24 +23,25 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("prayeralert")
|
||||
public interface PrayerAlertConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "alwaysShowAlert",
|
||||
name = "Always show prayer alert",
|
||||
description = "Show the alert, even without prayer restore in inventory"
|
||||
)
|
||||
default boolean alwaysShowAlert()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "oldRenderMode",
|
||||
name = "Render using old method",
|
||||
description = "Render the prayer alert using the old method"
|
||||
)
|
||||
default boolean oldRenderMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "alwaysShowAlert",
|
||||
name = "Always show prayer alert",
|
||||
description = "Show the alert, even without prayer restore in inventory"
|
||||
)
|
||||
default boolean alwaysShowAlert()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "oldRenderMode",
|
||||
name = "Render using old method",
|
||||
description = "Render the prayer alert using the old method"
|
||||
)
|
||||
default boolean oldRenderMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,16 @@
|
||||
|
||||
package net.runelite.client.plugins.prayeralert;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.itemstats.stats.Stat;
|
||||
import net.runelite.client.plugins.itemstats.stats.Stats;
|
||||
@@ -33,157 +39,169 @@ import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
class PrayerAlertOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final PrayerAlertConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final ItemManager itemManager;
|
||||
private final Client client;
|
||||
private final PrayerAlertConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final ItemManager itemManager;
|
||||
|
||||
private final Stat prayer = Stats.PRAYER;
|
||||
private final Stat prayer = Stats.PRAYER;
|
||||
|
||||
@Inject
|
||||
private PrayerAlertOverlay(Client client, PrayerAlertConfig config, ItemManager itemManager)
|
||||
{
|
||||
setPosition(OverlayPosition.TOP_RIGHT);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.itemManager = itemManager;
|
||||
}
|
||||
@Inject
|
||||
private PrayerAlertOverlay(Client client, PrayerAlertConfig config, ItemManager itemManager)
|
||||
{
|
||||
setPosition(OverlayPosition.TOP_RIGHT);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.itemManager = itemManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
int prayerLevel = getPrayerLevel();
|
||||
int prayerPoints = getPrayerPoints();
|
||||
if (config.oldRenderMode()){
|
||||
if (config.alwaysShowAlert()){
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
if (drink) {
|
||||
oldPrayerRestorePanel(graphics);
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
boolean hasPrayerPotion = checkInventoryForPotion();
|
||||
if (drink && hasPrayerPotion) {
|
||||
oldPrayerRestorePanel(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (config.alwaysShowAlert()){
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
if (drink) {
|
||||
prayerRestorePanel(panelComponent, graphics);
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
boolean hasPrayerPotion = checkInventoryForPotion();
|
||||
if (drink && hasPrayerPotion) {
|
||||
prayerRestorePanel(panelComponent, graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
int prayerLevel = getPrayerLevel();
|
||||
int prayerPoints = getPrayerPoints();
|
||||
if (config.oldRenderMode())
|
||||
{
|
||||
if (config.alwaysShowAlert())
|
||||
{
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
if (drink)
|
||||
{
|
||||
oldPrayerRestorePanel(graphics);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
boolean hasPrayerPotion = checkInventoryForPotion();
|
||||
if (drink && hasPrayerPotion)
|
||||
{
|
||||
oldPrayerRestorePanel(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config.alwaysShowAlert())
|
||||
{
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
if (drink)
|
||||
{
|
||||
prayerRestorePanel(panelComponent, graphics);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
|
||||
boolean hasPrayerPotion = checkInventoryForPotion();
|
||||
if (drink && hasPrayerPotion)
|
||||
{
|
||||
prayerRestorePanel(panelComponent, graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
|
||||
private int getPrayerLevel()
|
||||
{
|
||||
return prayer.getMaximum(client);
|
||||
}
|
||||
private int getPrayerLevel()
|
||||
{
|
||||
return prayer.getMaximum(client);
|
||||
}
|
||||
|
||||
private int getPrayerPoints()
|
||||
{
|
||||
return prayer.getValue(client);
|
||||
}
|
||||
private int getPrayerPoints()
|
||||
{
|
||||
return prayer.getValue(client);
|
||||
}
|
||||
|
||||
private boolean drinkPrayerPotion(int prayerLevel, int prayerPoints)
|
||||
{
|
||||
boolean drink = false;
|
||||
int prayerPotionRestoreValue = 7;
|
||||
double quarterOfPrayerLevel = (0.25) * (double) prayerLevel;
|
||||
private boolean drinkPrayerPotion(int prayerLevel, int prayerPoints)
|
||||
{
|
||||
boolean drink = false;
|
||||
int prayerPotionRestoreValue = 7;
|
||||
double quarterOfPrayerLevel = (0.25) * (double) prayerLevel;
|
||||
|
||||
prayerPotionRestoreValue = prayerPotionRestoreValue + (int) quarterOfPrayerLevel;
|
||||
prayerPotionRestoreValue = prayerPotionRestoreValue + (int) quarterOfPrayerLevel;
|
||||
|
||||
if (prayerPoints < (prayerLevel - prayerPotionRestoreValue))
|
||||
{
|
||||
drink = true;
|
||||
}
|
||||
if (prayerPoints < (prayerLevel - prayerPotionRestoreValue))
|
||||
{
|
||||
drink = true;
|
||||
}
|
||||
|
||||
return drink;
|
||||
}
|
||||
return drink;
|
||||
}
|
||||
|
||||
private boolean checkInventoryForPotion()
|
||||
{
|
||||
ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
||||
Item[] inventoryItems;
|
||||
boolean hasPrayerPotion = false;
|
||||
private boolean checkInventoryForPotion()
|
||||
{
|
||||
ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
||||
Item[] inventoryItems;
|
||||
boolean hasPrayerPotion = false;
|
||||
|
||||
int[] potionID = {ItemID.PRAYER_POTION1, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION1_20396, ItemID.PRAYER_POTION2_20395,
|
||||
ItemID.PRAYER_POTION3_20394, ItemID.PRAYER_POTION4_20393, ItemID.PRAYER_MIX1, ItemID.PRAYER_MIX2, ItemID.SUPER_RESTORE1, ItemID.SUPER_RESTORE2,
|
||||
ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE_MIX1, ItemID.SUPER_RESTORE_MIX2};
|
||||
int[] potionID = {ItemID.PRAYER_POTION1, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION1_20396, ItemID.PRAYER_POTION2_20395,
|
||||
ItemID.PRAYER_POTION3_20394, ItemID.PRAYER_POTION4_20393, ItemID.PRAYER_MIX1, ItemID.PRAYER_MIX2, ItemID.SUPER_RESTORE1, ItemID.SUPER_RESTORE2,
|
||||
ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE_MIX1, ItemID.SUPER_RESTORE_MIX2};
|
||||
|
||||
if (inventory != null)
|
||||
{
|
||||
inventoryItems = inventory.getItems();
|
||||
for (Item item : inventoryItems)
|
||||
{
|
||||
for (int prayerPotionId : potionID)
|
||||
{
|
||||
if (item.getId() == prayerPotionId)
|
||||
{
|
||||
hasPrayerPotion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventory != null)
|
||||
{
|
||||
inventoryItems = inventory.getItems();
|
||||
for (Item item : inventoryItems)
|
||||
{
|
||||
for (int prayerPotionId : potionID)
|
||||
{
|
||||
if (item.getId() == prayerPotionId)
|
||||
{
|
||||
hasPrayerPotion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasPrayerPotion;
|
||||
}
|
||||
return hasPrayerPotion;
|
||||
}
|
||||
|
||||
private void prayerRestorePanel(PanelComponent panelComponent, Graphics2D graphics){
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.PRAYER_POTION4)));
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Drink")
|
||||
.color(Color.RED)
|
||||
.build());
|
||||
panelComponent.setPreferredSize(new Dimension(
|
||||
graphics.getFontMetrics().stringWidth("Drink") + 12,0));
|
||||
}
|
||||
private void prayerRestorePanel(PanelComponent panelComponent, Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.PRAYER_POTION4)));
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Drink")
|
||||
.color(Color.RED)
|
||||
.build());
|
||||
panelComponent.setPreferredSize(new Dimension(
|
||||
graphics.getFontMetrics().stringWidth("Drink") + 12, 0));
|
||||
}
|
||||
|
||||
private void oldPrayerRestorePanel(Graphics2D graphics){
|
||||
graphics.translate(-100, 15);
|
||||
graphics.setColor(new Color(0.2f, 0.2f, 0.2f, 0.5f));
|
||||
graphics.fillRect(0, 0, 100, 45);
|
||||
private void oldPrayerRestorePanel(Graphics2D graphics)
|
||||
{
|
||||
graphics.translate(-100, 15);
|
||||
graphics.setColor(new Color(0.2f, 0.2f, 0.2f, 0.5f));
|
||||
graphics.fillRect(0, 0, 100, 45);
|
||||
|
||||
graphics.drawImage(itemManager.getImage(ItemID.PRAYER_POTION4), null, 14, 7);
|
||||
graphics.drawImage(itemManager.getImage(ItemID.PRAYER_POTION4), null, 14, 7);
|
||||
|
||||
Font dropShadow1 = FontManager.getRunescapeFont();
|
||||
dropShadow1 = dropShadow1.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(dropShadow1);
|
||||
graphics.setColor(new Color(0f, 0f, 0f, 0.6f));
|
||||
graphics.drawString("Drink", 56, 20);
|
||||
Font dropShadow1 = FontManager.getRunescapeFont();
|
||||
dropShadow1 = dropShadow1.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(dropShadow1);
|
||||
graphics.setColor(new Color(0f, 0f, 0f, 0.6f));
|
||||
graphics.drawString("Drink", 56, 20);
|
||||
|
||||
Font drinkFont1 = FontManager.getRunescapeFont();
|
||||
drinkFont1 = drinkFont1.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(drinkFont1);
|
||||
graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f));
|
||||
graphics.translate(-0.8, -0.8);
|
||||
graphics.drawString("Drink", 56, 20);
|
||||
Font drinkFont1 = FontManager.getRunescapeFont();
|
||||
drinkFont1 = drinkFont1.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(drinkFont1);
|
||||
graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f));
|
||||
graphics.translate(-0.8, -0.8);
|
||||
graphics.drawString("Drink", 56, 20);
|
||||
|
||||
Font dropShadow2 = FontManager.getRunescapeFont();
|
||||
dropShadow2 = dropShadow2.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(dropShadow2);
|
||||
graphics.setColor(new Color(0f, 0f, 0f, 0.6f));
|
||||
graphics.drawString("Potion", 53, 40);
|
||||
Font dropShadow2 = FontManager.getRunescapeFont();
|
||||
dropShadow2 = dropShadow2.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(dropShadow2);
|
||||
graphics.setColor(new Color(0f, 0f, 0f, 0.6f));
|
||||
graphics.drawString("Potion", 53, 40);
|
||||
|
||||
Font drinkFont2 = FontManager.getRunescapeFont();
|
||||
drinkFont2 = drinkFont2.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(drinkFont2);
|
||||
graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f));
|
||||
graphics.translate(-0.8, -0.8);
|
||||
graphics.drawString("Potion", 53, 40);
|
||||
}
|
||||
Font drinkFont2 = FontManager.getRunescapeFont();
|
||||
drinkFont2 = drinkFont2.deriveFont(Font.PLAIN);
|
||||
graphics.setFont(drinkFont2);
|
||||
graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f));
|
||||
graphics.translate(-0.8, -0.8);
|
||||
graphics.drawString("Potion", 53, 40);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,45 +18,42 @@ package net.runelite.client.plugins.prayeralert;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Prayer Alerter",
|
||||
description = "Alert the player when prayer is low",
|
||||
tags = {"prayer", "overlay"},
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
name = "Prayer Alerter",
|
||||
description = "Alert the player when prayer is low",
|
||||
tags = {"prayer", "overlay"},
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class PrayerAlertPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private PrayerAlertOverlay overlay;
|
||||
@Inject
|
||||
private PrayerAlertOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private PrayerAlertConfig config;
|
||||
@Provides
|
||||
PrayerAlertConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PrayerAlertConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
PrayerAlertConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PrayerAlertConfig.class);
|
||||
}
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,10 @@ class ProfilePanel extends JPanel
|
||||
}
|
||||
|
||||
private final String loginText;
|
||||
private final ProfilesPanel parent;
|
||||
private String password = null;
|
||||
|
||||
ProfilePanel(final Client client, String data, ProfilesConfig config, ProfilesPanel parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
String[] parts = data.split(":");
|
||||
this.loginText = parts[1];
|
||||
if (parts.length == 3)
|
||||
|
||||
@@ -31,8 +31,6 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("profiles")
|
||||
public interface ProfilesConfig extends Config
|
||||
{
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "profilesData",
|
||||
name = "",
|
||||
@@ -50,22 +48,22 @@ public interface ProfilesConfig extends Config
|
||||
description = ""
|
||||
)
|
||||
void profilesData(String str);
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "salt",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
keyName = "salt",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default String salt()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "salt",
|
||||
name = "",
|
||||
description = ""
|
||||
keyName = "salt",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void salt(String key);
|
||||
|
||||
|
||||
@@ -51,9 +51,14 @@ import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.*;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
@@ -71,35 +76,33 @@ class ProfilesPanel extends PluginPanel
|
||||
private static final String PASSWORD_LABEL = "Account Password";
|
||||
private static final String HELP = "To add and load accounts, first enter a password into the Encryption Password " +
|
||||
"field then press Load Accounts. You can now add as many accounts as you would like. The next time you restart" +
|
||||
" Runelite, enter your encryption password and click load accounts to see the accounts you entered";
|
||||
"Runelite, enter your encryption password and click load accounts to see the accounts you entered";
|
||||
private static final Dimension PREFERRED_SIZE = new Dimension(PluginPanel.PANEL_WIDTH - 20, 30);
|
||||
private static final Dimension HELP_PREFERRED_SIZE = new Dimension(PluginPanel.PANEL_WIDTH - 20, 130);
|
||||
|
||||
private static final Dimension MINIMUM_SIZE = new Dimension(0, 30);
|
||||
|
||||
|
||||
private final Client client;
|
||||
private static ProfilesConfig profilesConfig;
|
||||
|
||||
|
||||
private final JPasswordField txtDecryptPassword = new JPasswordField(UNLOCK_PASSWORD);
|
||||
private final JButton btnLoadAccounts = new JButton(LOAD_ACCOUNTS);
|
||||
private final JTextField txtAccountLabel = new JTextField(ACCOUNT_LABEL);
|
||||
private final JPasswordField txtAccountLogin = new JPasswordField(ACCOUNT_USERNAME);
|
||||
private final JPasswordField txtPasswordLogin = new JPasswordField(PASSWORD_LABEL);
|
||||
private final JPanel profilesPanel = new JPanel();
|
||||
private final JPanel helpPanel = new JPanel(new BorderLayout());
|
||||
private GridBagConstraints c;
|
||||
|
||||
|
||||
@Inject
|
||||
public ProfilesPanel(Client client, ProfilesConfig config)
|
||||
{
|
||||
super();
|
||||
this.client = client;
|
||||
profilesConfig = config;
|
||||
|
||||
|
||||
setBorder(new EmptyBorder(18, 10, 0, 10));
|
||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
|
||||
c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.gridx = 0;
|
||||
@@ -108,18 +111,18 @@ class ProfilesPanel extends PluginPanel
|
||||
c.weighty = 0;
|
||||
c.insets = new Insets(0, 0, 4, 0);
|
||||
|
||||
JPanel helpPanel = new JPanel(new BorderLayout());
|
||||
helpPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
JLabel helpLabel = new JLabel("<html> <p>" + HELP + "</p></html>");
|
||||
helpLabel.setFont(FontManager.getRunescapeSmallFont());
|
||||
helpPanel.setPreferredSize(HELP_PREFERRED_SIZE);
|
||||
//helpPanel.setSize(MINIMUM_SIZE);
|
||||
// helpPanel.setSize(MINIMUM_SIZE);
|
||||
helpPanel.add(helpLabel, BorderLayout.NORTH);
|
||||
|
||||
add(helpPanel);
|
||||
c.gridy = c.gridy + 3;
|
||||
c.gridy++;
|
||||
|
||||
|
||||
txtDecryptPassword.setEchoChar((char) 0);
|
||||
txtDecryptPassword.setPreferredSize(PREFERRED_SIZE);
|
||||
txtDecryptPassword.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
@@ -138,7 +141,7 @@ class ProfilesPanel extends PluginPanel
|
||||
txtDecryptPassword.setEchoChar('*');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e)
|
||||
{
|
||||
@@ -150,10 +153,11 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(txtDecryptPassword, c);
|
||||
c.gridy++;
|
||||
|
||||
|
||||
JButton btnLoadAccounts = new JButton(LOAD_ACCOUNTS);
|
||||
btnLoadAccounts.setPreferredSize(PREFERRED_SIZE);
|
||||
btnLoadAccounts.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
btnLoadAccounts.setMinimumSize(MINIMUM_SIZE);
|
||||
@@ -163,15 +167,15 @@ class ProfilesPanel extends PluginPanel
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
@@ -184,23 +188,23 @@ class ProfilesPanel extends PluginPanel
|
||||
showErrorMessage("Unable to load data", "Incorrect password!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(btnLoadAccounts, c);
|
||||
c.gridy++;
|
||||
|
||||
|
||||
txtAccountLabel.setPreferredSize(PREFERRED_SIZE);
|
||||
txtAccountLabel.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
txtAccountLabel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
@@ -216,7 +220,7 @@ class ProfilesPanel extends PluginPanel
|
||||
txtAccountLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e)
|
||||
{
|
||||
@@ -227,10 +231,10 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(txtAccountLabel, c);
|
||||
c.gridy++;
|
||||
|
||||
|
||||
// Do not hide username characters until they focus or if in streamer mode
|
||||
txtAccountLogin.setEchoChar((char) 0);
|
||||
txtAccountLogin.setPreferredSize(PREFERRED_SIZE);
|
||||
@@ -252,7 +256,7 @@ class ProfilesPanel extends PluginPanel
|
||||
txtAccountLogin.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e)
|
||||
{
|
||||
@@ -264,10 +268,10 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(txtAccountLogin, c);
|
||||
c.gridy++;
|
||||
|
||||
|
||||
txtPasswordLogin.setEchoChar((char) 0);
|
||||
txtPasswordLogin.setPreferredSize(PREFERRED_SIZE);
|
||||
txtPasswordLogin.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
@@ -286,7 +290,7 @@ class ProfilesPanel extends PluginPanel
|
||||
txtPasswordLogin.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e)
|
||||
{
|
||||
@@ -298,15 +302,15 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (config.rememberPassword())
|
||||
{
|
||||
add(txtPasswordLogin, c);
|
||||
c.gridy++;
|
||||
}
|
||||
c.insets = new Insets(0, 0, 15, 0);
|
||||
|
||||
|
||||
JButton btnAddAccount = new JButton("Add Account");
|
||||
btnAddAccount.setPreferredSize(PREFERRED_SIZE);
|
||||
btnAddAccount.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
@@ -316,7 +320,7 @@ class ProfilesPanel extends PluginPanel
|
||||
String labelText = String.valueOf(txtAccountLabel.getText());
|
||||
String loginText = String.valueOf(txtAccountLogin.getPassword());
|
||||
String passwordText = String.valueOf(txtPasswordLogin.getPassword());
|
||||
|
||||
|
||||
if (labelText.equals(ACCOUNT_LABEL) || loginText.equals(ACCOUNT_USERNAME))
|
||||
{
|
||||
return;
|
||||
@@ -330,10 +334,10 @@ class ProfilesPanel extends PluginPanel
|
||||
{
|
||||
data = labelText + ":" + loginText;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if(!addProfile(data))
|
||||
if (!addProfile(data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -342,21 +346,21 @@ class ProfilesPanel extends PluginPanel
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
this.addAccount(data);
|
||||
|
||||
|
||||
txtAccountLabel.setText(ACCOUNT_LABEL);
|
||||
txtAccountLabel.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
|
||||
|
||||
txtAccountLogin.setText(ACCOUNT_USERNAME);
|
||||
txtAccountLogin.setEchoChar((char) 0);
|
||||
txtAccountLogin.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
|
||||
|
||||
txtPasswordLogin.setText(PASSWORD_LABEL);
|
||||
txtPasswordLogin.setEchoChar((char) 0);
|
||||
txtPasswordLogin.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
});
|
||||
|
||||
|
||||
txtAccountLogin.addKeyListener(new KeyAdapter()
|
||||
{
|
||||
@Override
|
||||
@@ -374,46 +378,46 @@ class ProfilesPanel extends PluginPanel
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
add(btnAddAccount, c);
|
||||
c.gridy++;
|
||||
|
||||
|
||||
profilesPanel.setLayout(new GridBagLayout());
|
||||
add(profilesPanel, c);
|
||||
c.gridy = 0;
|
||||
c.insets = new Insets(0, 0, 5, 0);
|
||||
|
||||
//addAccounts(config.profilesData());
|
||||
|
||||
// addAccounts(config.profilesData());
|
||||
}
|
||||
|
||||
void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
|
||||
private void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
{
|
||||
profilesPanel.removeAll();
|
||||
c.gridy = 0;
|
||||
@@ -422,20 +426,20 @@ class ProfilesPanel extends PluginPanel
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
private void addAccount(String data)
|
||||
{
|
||||
ProfilePanel profile = new ProfilePanel(client, data, profilesConfig, this);
|
||||
c.gridy++;
|
||||
profilesPanel.add(profile, c);
|
||||
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void addAccounts(String data)
|
||||
|
||||
private void addAccounts(String data)
|
||||
{
|
||||
//log.info("Data: " + data);
|
||||
// log.info("Data: " + data);
|
||||
data = data.trim();
|
||||
if (!data.contains(":"))
|
||||
{
|
||||
@@ -443,39 +447,39 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
Arrays.stream(data.split("\\n")).forEach(this::addAccount);
|
||||
}
|
||||
|
||||
boolean addProfile(String data) throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
|
||||
private boolean addProfile(String data) throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
{
|
||||
return setProfileData(
|
||||
getProfileData() + data + "\n");
|
||||
getProfileData() + data + "\n");
|
||||
}
|
||||
|
||||
|
||||
void removeProfile(String data) throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
{
|
||||
setProfileData(
|
||||
getProfileData().replaceAll(data + "\\n", ""));
|
||||
getProfileData().replaceAll(data + "\\n", ""));
|
||||
revalidate();
|
||||
repaint();
|
||||
|
||||
}
|
||||
|
||||
void setSalt(byte[] bytes)
|
||||
|
||||
private void setSalt(byte[] bytes)
|
||||
{
|
||||
profilesConfig.salt(base64Encode(bytes));
|
||||
}
|
||||
|
||||
byte[] getSalt()
|
||||
|
||||
private byte[] getSalt()
|
||||
{
|
||||
if(profilesConfig.salt().length() == 0)
|
||||
if (profilesConfig.salt().length() == 0)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
return base64Decode(profilesConfig.salt());
|
||||
}
|
||||
|
||||
SecretKey getAesKey() throws NoSuchAlgorithmException, InvalidKeySpecException
|
||||
|
||||
private SecretKey getAesKey() throws NoSuchAlgorithmException, InvalidKeySpecException
|
||||
{
|
||||
if(getSalt().length == 0)
|
||||
if (getSalt().length == 0)
|
||||
{
|
||||
byte[] b = new byte[16];
|
||||
SecureRandom.getInstanceStrong().nextBytes(b);
|
||||
@@ -483,16 +487,15 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||
KeySpec spec = new PBEKeySpec(txtDecryptPassword.getPassword(), getSalt(), iterations, 128);
|
||||
SecretKey key = factory.generateSecret(spec);
|
||||
return key;
|
||||
return factory.generateSecret(spec);
|
||||
}
|
||||
|
||||
String getProfileData() throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
|
||||
private String getProfileData() throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
{
|
||||
String tmp = profilesConfig.profilesData();
|
||||
if(tmp.startsWith("¬"))
|
||||
if (tmp.startsWith("¬"))
|
||||
{
|
||||
if(txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD))
|
||||
if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD))
|
||||
{
|
||||
showErrorMessage("Unable to load data", "Please enter a password!");
|
||||
return tmp;
|
||||
@@ -502,39 +505,41 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
boolean setProfileData(String data) throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
|
||||
private boolean setProfileData(String data) throws InvalidKeySpecException, NoSuchAlgorithmException
|
||||
{
|
||||
if(txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD))
|
||||
if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD))
|
||||
{
|
||||
showErrorMessage("Unable to save data", "Please enter a password!");
|
||||
return false;
|
||||
}
|
||||
byte[] enc = encryptText(data, getAesKey());
|
||||
if(enc.length == 0)
|
||||
if (enc.length == 0)
|
||||
{
|
||||
return false;
|
||||
String s = "¬"+base64Encode(enc);
|
||||
}
|
||||
String s = "¬" + base64Encode(enc);
|
||||
profilesConfig.profilesData(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] base64Decode(String data)
|
||||
|
||||
private byte[] base64Decode(String data)
|
||||
{
|
||||
return Base64.getDecoder().decode(data);
|
||||
}
|
||||
|
||||
public String base64Encode(byte[] data)
|
||||
|
||||
private String base64Encode(byte[] data)
|
||||
{
|
||||
return Base64.getEncoder().encodeToString(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encrypts login info
|
||||
*
|
||||
* @param text text to encrypt
|
||||
* @return encrypted string
|
||||
*/
|
||||
public static byte[] encryptText(String text, SecretKey aesKey)
|
||||
private static byte[] encryptText(String text, SecretKey aesKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -549,8 +554,8 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
public static String decryptText(byte[] enc, SecretKey aesKey)
|
||||
|
||||
private static String decryptText(byte[] enc, SecretKey aesKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -565,13 +570,13 @@ class ProfilesPanel extends PluginPanel
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void showErrorMessage(String title, String text)
|
||||
|
||||
private static void showErrorMessage(String title, String text)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(null,
|
||||
text,
|
||||
title,
|
||||
JOptionPane.ERROR_MESSAGE));
|
||||
text,
|
||||
title,
|
||||
JOptionPane.ERROR_MESSAGE));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,19 +25,9 @@
|
||||
package net.runelite.client.plugins.profiles;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.Key;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.logging.Logger;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -46,8 +36,6 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import javax.inject.Inject;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Account Switcher",
|
||||
@@ -60,13 +48,6 @@ public class ProfilesPlugin extends Plugin
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ProfilesConfig config;
|
||||
|
||||
|
||||
private ProfilesPanel panel;
|
||||
private NavigationButton navButton;
|
||||
|
||||
@@ -92,7 +73,6 @@ public class ProfilesPlugin extends Plugin
|
||||
.build();
|
||||
|
||||
clientToolbar.addNavigation(navButton);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +80,7 @@ public class ProfilesPlugin extends Plugin
|
||||
{
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event) throws Exception
|
||||
{
|
||||
|
||||
@@ -9,20 +9,26 @@
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class CurrentPlayersJFrame extends JFrame
|
||||
{
|
||||
|
||||
public JList currentPlayersJList;
|
||||
public JList<Object> currentPlayersJList;
|
||||
|
||||
CurrentPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list)
|
||||
{
|
||||
@@ -35,7 +41,7 @@ public class CurrentPlayersJFrame extends JFrame
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.currentPlayersActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
currentPlayersJList = new JList(list.toArray());
|
||||
currentPlayersJList = new JList<>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e ->
|
||||
{
|
||||
StringSelection stringSelection;
|
||||
|
||||
@@ -10,28 +10,25 @@
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class MissingPlayersJFrame extends JFrame
|
||||
{
|
||||
|
||||
public JList missingPlayersJList;
|
||||
public JList<Object> missingPlayersJList;
|
||||
|
||||
MissingPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list)
|
||||
{
|
||||
@@ -44,7 +41,7 @@ public class MissingPlayersJFrame extends JFrame
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.playersButtonActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
missingPlayersJList = new JList(list.toArray());
|
||||
missingPlayersJList = new JList<>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e ->
|
||||
{
|
||||
StringSelection stringSelection;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.security.Key;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -33,8 +31,7 @@ public interface PvpToolsConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "countOverHeads",
|
||||
name = "Count Enemy Overheads",
|
||||
description = "Counts the number of each protection prayer attackable targets not in your CC are currently" +
|
||||
" using",
|
||||
description = "Counts the number of each protection prayer attackable targets not in your CC are currently using",
|
||||
position = 4
|
||||
)
|
||||
default boolean countOverHeads()
|
||||
@@ -63,7 +60,7 @@ public interface PvpToolsConfig extends Config
|
||||
{
|
||||
return Keybind.NOT_SET;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "renderSelfHotkey",
|
||||
name = "Render Self Hotkey",
|
||||
@@ -100,11 +97,11 @@ public interface PvpToolsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "levelRangeAttackOptions",
|
||||
name = "Moves Other Attack Options",
|
||||
description = "Moves the attack option for people that are outside your level range",
|
||||
position = 10,
|
||||
group = "Right-Click Attack Options"
|
||||
keyName = "levelRangeAttackOptions",
|
||||
name = "Moves Other Attack Options",
|
||||
description = "Moves the attack option for people that are outside your level range",
|
||||
position = 10,
|
||||
group = "Right-Click Attack Options"
|
||||
)
|
||||
default boolean levelRangeAttackOptions()
|
||||
{
|
||||
@@ -125,18 +122,19 @@ public interface PvpToolsConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "missingPlayers",
|
||||
name = "Missing CC Players",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members are not at" +
|
||||
" the current players location",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members are not at the current players location",
|
||||
position = 15
|
||||
)
|
||||
default boolean missingPlayersEnabled() { return true; }
|
||||
default boolean missingPlayersEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "currentPlayers",
|
||||
name = "Current CC Players",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members currently at" +
|
||||
" the players location",
|
||||
position = 16
|
||||
keyName = "currentPlayers",
|
||||
name = "Current CC Players",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members currently at the players location",
|
||||
position = 16
|
||||
)
|
||||
default boolean currentPlayersEnabled()
|
||||
{
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -40,7 +39,7 @@ public class PvpToolsOverlay extends Overlay
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,21 +33,18 @@ public class PvpToolsPanel extends PluginPanel
|
||||
|
||||
private final JLabel loggedLabel = new JLabel();
|
||||
private final JRichTextPane emailLabel = new JRichTextPane();
|
||||
public JLabel numCC = new JLabel();
|
||||
public JLabel numOther = new JLabel();
|
||||
public JLabel numMageJLabel = new JLabel(" ");
|
||||
public JLabel numRangeJLabel = new JLabel(" ");
|
||||
public JLabel numMeleeJLabel = new JLabel(" ");
|
||||
public JLabel totalRiskLabel = new JLabel(" ");
|
||||
public JLabel riskProtectingItem = new JLabel(" ");
|
||||
public JLabel biggestItemLabel = new JLabel("Protected Item: ");
|
||||
public JButton missingPlayers = new JButton("Show missing CC members");
|
||||
public JButton currentPlayers = new JButton("Show current CC members");
|
||||
public JLabel numBrews = new JLabel();
|
||||
@Inject
|
||||
private JPanel pvpToolsPanel = new JPanel(new GridLayout(11, 1));
|
||||
JLabel numCC = new JLabel();
|
||||
JLabel numOther = new JLabel();
|
||||
JLabel numMageJLabel = new JLabel(" ");
|
||||
JLabel numRangeJLabel = new JLabel(" ");
|
||||
JLabel numMeleeJLabel = new JLabel(" ");
|
||||
JLabel totalRiskLabel = new JLabel(" ");
|
||||
JLabel riskProtectingItem = new JLabel(" ");
|
||||
JLabel biggestItemLabel = new JLabel("Protected Item: ");
|
||||
JButton missingPlayers = new JButton("Show missing CC members");
|
||||
JButton currentPlayers = new JButton("Show current CC members");
|
||||
private JLabel numBrews = new JLabel();
|
||||
private JPanel missingPlayersPanel = new JPanel();
|
||||
private JPanel currentPlayersPanel = new JPanel();
|
||||
|
||||
|
||||
public static String htmlLabel(String key, String value)
|
||||
@@ -62,7 +59,6 @@ public class PvpToolsPanel extends PluginPanel
|
||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
|
||||
|
||||
|
||||
JPanel versionPanel = new JPanel();
|
||||
versionPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
@@ -136,7 +132,7 @@ public class PvpToolsPanel extends PluginPanel
|
||||
|
||||
}
|
||||
|
||||
public void disablePlayerCount()
|
||||
void disablePlayerCount()
|
||||
{
|
||||
this.numOther.setText("Disabled");
|
||||
this.numCC.setText("Disabled");
|
||||
@@ -144,7 +140,7 @@ public class PvpToolsPanel extends PluginPanel
|
||||
this.numOther.repaint();
|
||||
}
|
||||
|
||||
public void disablePrayerCount()
|
||||
void disablePrayerCount()
|
||||
{
|
||||
this.numMageJLabel.setText("disabled");
|
||||
this.numRangeJLabel.setText("disabled");
|
||||
@@ -154,7 +150,7 @@ public class PvpToolsPanel extends PluginPanel
|
||||
this.numMeleeJLabel.repaint();
|
||||
}
|
||||
|
||||
public void disableRiskCalculator()
|
||||
void disableRiskCalculator()
|
||||
{
|
||||
this.totalRiskLabel.setText("disabled");
|
||||
this.riskProtectingItem.setText("disabled");
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.NavigableMap;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
@@ -45,13 +44,11 @@ import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.AsyncBufferedImage;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.plugins.clanchat.ClanChatPlugin;
|
||||
import static net.runelite.client.plugins.pvptools.PvpToolsPanel.htmlLabel;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
@@ -74,25 +71,30 @@ public class PvpToolsPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
PvpToolsOverlay pvpToolsOverlay;
|
||||
|
||||
boolean fallinHelperEnabled = false;
|
||||
private PvpToolsPanel panel;
|
||||
private MissingPlayersJFrame missingPlayersJFrame;
|
||||
private CurrentPlayersJFrame currentPlayersJFrame;
|
||||
private NavigationButton navButton;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean attackHotKeyPressed;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hideAll;
|
||||
@Inject
|
||||
private ScheduledExecutorService executorService;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
private PvpToolsPlugin uhPvpToolsPlugin = this;
|
||||
|
||||
/**
|
||||
@@ -144,15 +146,6 @@ public class PvpToolsPlugin extends Plugin
|
||||
@Inject
|
||||
private PvpToolsConfig config;
|
||||
|
||||
@Inject
|
||||
private PluginManager pluginManager;
|
||||
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
|
||||
|
||||
private ClanChatPlugin clanChatPlugin;
|
||||
|
||||
/**
|
||||
* The HotKeyListener for the hot key assigned in the config that triggers the Fall In Helper feature
|
||||
*/
|
||||
@@ -163,7 +156,7 @@ public class PvpToolsPlugin extends Plugin
|
||||
toggleFallinHelper();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private final HotkeyListener renderselfHotkeyListener = new HotkeyListener(() -> config.renderSelf())
|
||||
{
|
||||
public void hotkeyPressed()
|
||||
@@ -174,23 +167,11 @@ public class PvpToolsPlugin extends Plugin
|
||||
|
||||
private int[] overheadCount = new int[]{0, 0, 0};
|
||||
|
||||
private Comparator<Item> itemPriceComparator = new Comparator<Item>()
|
||||
{
|
||||
@Override
|
||||
public int compare(Item o1, Item o2)
|
||||
{
|
||||
return (itemManager.getItemPrice(itemManager.getItemComposition(o1.getId()).getPrice())
|
||||
- itemManager.getItemPrice(itemManager.getItemComposition(o2.getId()).getPrice()));
|
||||
}
|
||||
};
|
||||
|
||||
private String mtarget;
|
||||
|
||||
public List getMissingMembers()
|
||||
private List<String> getMissingMembers()
|
||||
{
|
||||
CopyOnWriteArrayList<Player> ccMembers = ClanChatPlugin.getClanMembers();
|
||||
ArrayList missingMembers = new ArrayList();
|
||||
for (ClanMember clanMember:client.getClanMembers())
|
||||
ArrayList<String> missingMembers = new ArrayList<>();
|
||||
for (ClanMember clanMember : client.getClanMembers())
|
||||
{
|
||||
if (!Objects.isNull(clanMember))
|
||||
{
|
||||
@@ -206,16 +187,13 @@ public class PvpToolsPlugin extends Plugin
|
||||
}
|
||||
|
||||
return missingMembers;
|
||||
|
||||
//Arrays.stream(Arrays.stream(client.getClanMembers()).filter(Objects::nonNull).map(ClanMember::getUsername)
|
||||
//.toArray()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List getCurrentMembers()
|
||||
private List<String> getCurrentMembers()
|
||||
{
|
||||
CopyOnWriteArrayList<Player> ccMembers = ClanChatPlugin.getClanMembers();
|
||||
ArrayList currentMembers = new ArrayList();
|
||||
for (ClanMember clanMember:client.getClanMembers())
|
||||
ArrayList<String> currentMembers = new ArrayList<>();
|
||||
for (ClanMember clanMember : client.getClanMembers())
|
||||
{
|
||||
if (!Objects.isNull(clanMember))
|
||||
{
|
||||
@@ -231,13 +209,9 @@ public class PvpToolsPlugin extends Plugin
|
||||
}
|
||||
|
||||
return currentMembers;
|
||||
|
||||
//Arrays.stream(Arrays.stream(client.getClanMembers()).filter(Objects::nonNull).map(ClanMember::getUsername)
|
||||
//.toArray()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Provides
|
||||
PvpToolsConfig config(ConfigManager configManager)
|
||||
{
|
||||
@@ -247,7 +221,6 @@ public class PvpToolsPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
overlayManager.add(pvpToolsOverlay);
|
||||
|
||||
keyManager.registerKeyListener(fallinHotkeyListener);
|
||||
@@ -399,65 +372,47 @@ public class PvpToolsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
if (config.attackOptionsFriend() || config.attackOptionsClan() || config.levelRangeAttackOptions())
|
||||
if (config.attackOptionsFriend() || config.attackOptionsClan() || config.levelRangeAttackOptions())
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
return;
|
||||
}
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
int identifier = menuEntryAdded.getIdentifier();
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
{
|
||||
player = players[identifier];
|
||||
}
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (attackHotKeyPressed && config.attackOptionsClan() || config.attackOptionsFriend() ||
|
||||
config.levelRangeAttackOptions())
|
||||
{
|
||||
if (config.attackOptionsFriend() && player.isFriend())
|
||||
{
|
||||
return;
|
||||
moveEntry();
|
||||
}
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
int identifier = menuEntryAdded.getIdentifier();
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
if (config.attackOptionsClan() && player.isClanMember())
|
||||
{
|
||||
player = players[identifier];
|
||||
moveEntry();
|
||||
}
|
||||
if (player == null)
|
||||
if (config.levelRangeAttackOptions() && !PvPUtil.isAttackable(client, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final String option = Text.removeTags(menuEntryAdded.getOption()).toLowerCase();
|
||||
final String mtarget = Text.removeTags(menuEntryAdded.getTarget()).toLowerCase();
|
||||
if (attackHotKeyPressed && config.attackOptionsClan() || config.attackOptionsFriend() ||
|
||||
config.levelRangeAttackOptions())
|
||||
{
|
||||
if (config.attackOptionsFriend() && player.isFriend())
|
||||
{
|
||||
moveEntry(mtarget);
|
||||
}
|
||||
if (config.attackOptionsClan() && player.isClanMember())
|
||||
{
|
||||
moveEntry(mtarget);
|
||||
}
|
||||
if (config.levelRangeAttackOptions() && !PvPUtil.isAttackable(client, player))
|
||||
{
|
||||
moveEntry(mtarget);
|
||||
}
|
||||
moveEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveEntry(String mtarget)
|
||||
private void moveEntry()
|
||||
{
|
||||
this.mtarget = mtarget;
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
||||
|
||||
// strip out existing <col...
|
||||
String target = lastEntry.getTarget();
|
||||
int idx = target.indexOf('>');
|
||||
if (idx != -1)
|
||||
{
|
||||
target = target.substring(idx + 1);
|
||||
}
|
||||
/*System.out.println("Contents : " + lastEntry.getTarget());
|
||||
System.out.println("Contents : " + lastEntry.getIdentifier());
|
||||
System.out.println("Contents : " + lastEntry.getOption());
|
||||
System.out.println("length : " + menuEntries.length);*/
|
||||
if (menuEntries[menuEntries.length - 1] != null)
|
||||
{
|
||||
//System.out.println(menuEntries.length + ": " + menuEntries[menuEntries.length-1]);
|
||||
}
|
||||
if (lastEntry.getOption().contains("attack".toLowerCase()))
|
||||
{
|
||||
ArrayUtils.shift(menuEntries, 1);
|
||||
@@ -468,10 +423,8 @@ public class PvpToolsPlugin extends Plugin
|
||||
if (lastEntry.getOption().equals("Attack"))
|
||||
{
|
||||
ArrayUtils.shift(menuEntries, 1);
|
||||
|
||||
//menuEntries = ArrayUtils.sremove(menuEntries, menuEntries.length - 1);
|
||||
//menuEntrySwapperPlugin.swap("attack", option, mtarget, false);
|
||||
}
|
||||
|
||||
client.setMenuEntries(menuEntries);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,13 +33,16 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("runeliteplus")
|
||||
public interface RuneLitePlusConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "customPresence",
|
||||
name = "RL+ Presence",
|
||||
description = "Represent RL+ with a custom icon and discord presence."
|
||||
)
|
||||
default boolean customPresence() { return false; }
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "customPresence",
|
||||
name = "RL+ Presence",
|
||||
description = "Represent RL+ with a custom icon and discord presence."
|
||||
)
|
||||
default boolean customPresence()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableOpacity",
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.runeliteplus;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
@@ -39,8 +40,6 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@PluginDescriptor(
|
||||
loadWhenOutdated = true, // prevent users from disabling
|
||||
hidden = true, // prevent users from disabling
|
||||
@@ -67,7 +66,7 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
|
||||
|
||||
@Provides
|
||||
RuneLitePlusConfig getConfig(ConfigManager configManager)
|
||||
RuneLitePlusConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RuneLitePlusConfig.class);
|
||||
}
|
||||
@@ -75,16 +74,20 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
if (getConfig(configManager).customPresence()) {
|
||||
if (getConfig(configManager).customPresence())
|
||||
{
|
||||
ClientUI.currentPresenceName = ("RuneLitePlus");
|
||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||
}
|
||||
|
||||
if (config.customPresence()) {
|
||||
if (config.customPresence())
|
||||
{
|
||||
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
||||
discordService.close();
|
||||
discordService.init();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
RuneLiteProperties.discordAppID = rlDiscordApp;
|
||||
discordService.close();
|
||||
discordService.init();
|
||||
@@ -92,21 +95,29 @@ public class RuneLitePlusPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onConfigChanged(ConfigChanged event) {
|
||||
if (event.getKey().equals("customPresence")) {
|
||||
if (config.customPresence()) {
|
||||
protected void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getKey().equals("customPresence"))
|
||||
{
|
||||
if (config.customPresence())
|
||||
{
|
||||
ClientUI.currentPresenceName = ("RuneLitePlus");
|
||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientUI.currentPresenceName = ("RuneLite");
|
||||
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
|
||||
}
|
||||
|
||||
if (config.customPresence()) {
|
||||
if (config.customPresence())
|
||||
{
|
||||
RuneLiteProperties.discordAppID = rlPlusDiscordApp;
|
||||
discordService.close();
|
||||
discordService.init();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
RuneLiteProperties.discordAppID = rlDiscordApp;
|
||||
discordService.close();
|
||||
discordService.init();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SafeSpotOverlay extends Overlay
|
||||
{
|
||||
if (safeSpotPlugin.isSafeSpotsRenderable())
|
||||
{
|
||||
if(safeSpotPlugin.getSafeSpotList() != null)
|
||||
if (safeSpotPlugin.getSafeSpotList() != null)
|
||||
{
|
||||
if (safeSpotPlugin.getSafeSpotList().size() > 0)
|
||||
{
|
||||
|
||||
@@ -40,16 +40,18 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
)
|
||||
public class SafeSpotPlugin extends Plugin
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private SafeSpotConfig config;
|
||||
|
||||
@Getter
|
||||
private ArrayList<Tile> safeSpotList;
|
||||
|
||||
@Getter
|
||||
private boolean safeSpotsRenderable = false;
|
||||
|
||||
@@ -132,7 +134,8 @@ public class SafeSpotPlugin extends Plugin
|
||||
|
||||
/**
|
||||
* The ArrayList of 1-way safe spots
|
||||
* @param actor - The Actor that the tiles are a safe spot against
|
||||
*
|
||||
* @param actor - The Actor that the tiles are a safe spot against
|
||||
* @param worldPoints - Worldpoints in the current scene
|
||||
* @return an ArrayList of Tiles where current player can attack actor but actor cannot attack local player
|
||||
*/
|
||||
@@ -140,7 +143,7 @@ public class SafeSpotPlugin extends Plugin
|
||||
{
|
||||
ArrayList<Tile> safeSpotList = new ArrayList<>();
|
||||
Tile[][][] tiles = client.getScene().getTiles();
|
||||
for (WorldPoint w:worldPoints)
|
||||
for (WorldPoint w : worldPoints)
|
||||
{
|
||||
LocalPoint toPoint = LocalPoint.fromWorld(client, w);
|
||||
Tile fromTile = tiles[client.getPlane()][actor.getLocalLocation().getSceneX()]
|
||||
@@ -151,11 +154,11 @@ public class SafeSpotPlugin extends Plugin
|
||||
int bit = client.getCollisionMaps()[plane].getFlags()[toPoint.getSceneX()][toPoint.getSceneY()];
|
||||
if (toTile.hasLineOfSightTo(fromTile) && !fromTile.hasLineOfSightTo(toTile))
|
||||
{
|
||||
if (!((bit & CollisionDataFlag.BLOCK_MOVEMENT_OBJECT ) == CollisionDataFlag.BLOCK_MOVEMENT_OBJECT ||
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FLOOR_DECORATION )
|
||||
if (!((bit & CollisionDataFlag.BLOCK_MOVEMENT_OBJECT) == CollisionDataFlag.BLOCK_MOVEMENT_OBJECT ||
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FLOOR_DECORATION)
|
||||
== CollisionDataFlag.BLOCK_MOVEMENT_FLOOR_DECORATION ||
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FLOOR ) == CollisionDataFlag.BLOCK_MOVEMENT_FLOOR ||
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FULL ) == CollisionDataFlag.BLOCK_MOVEMENT_FULL))
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FLOOR) == CollisionDataFlag.BLOCK_MOVEMENT_FLOOR ||
|
||||
(bit & CollisionDataFlag.BLOCK_MOVEMENT_FULL) == CollisionDataFlag.BLOCK_MOVEMENT_FULL))
|
||||
{
|
||||
safeSpotList.add(toTile);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
name = "Slayermusiq1 Guides",
|
||||
description = "Adds a right-click option to go to Slayermusiq1's guides from the quest tab",
|
||||
tags = {"quest", "guide", "slayermusiq"},
|
||||
type = PluginType.UTILITY
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class SlayermusiqPlugin extends Plugin
|
||||
|
||||
@@ -1,77 +1,82 @@
|
||||
package net.runelite.client.plugins.tickcounter;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@ConfigGroup("tickcounter")
|
||||
public interface TickCounterConfig extends Config {
|
||||
@ConfigItem(
|
||||
keyName = "resetInstance",
|
||||
name = "Reset on new instances",
|
||||
description = "",
|
||||
position = 1
|
||||
)
|
||||
default boolean instance()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "selfColor",
|
||||
name = "Your color",
|
||||
description = "",
|
||||
position = 4
|
||||
)
|
||||
default Color selfColor()
|
||||
{
|
||||
return Color.green;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "totalColor",
|
||||
name = "Total color",
|
||||
description = "",
|
||||
position = 6
|
||||
)
|
||||
default Color totalColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "otherColor",
|
||||
name = "Other players color",
|
||||
description = "",
|
||||
position = 5
|
||||
)
|
||||
default Color otherColor()
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "bgColor",
|
||||
name = "Background color",
|
||||
description = "",
|
||||
position = 3
|
||||
)
|
||||
default Color bgColor()
|
||||
{
|
||||
return new Color(70, 61, 50, 156);
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "titleColor",
|
||||
name = "Title color",
|
||||
description = "",
|
||||
position = 2
|
||||
)
|
||||
default Color titleColor()
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
public interface TickCounterConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "resetInstance",
|
||||
name = "Reset on new instances",
|
||||
description = "",
|
||||
position = 1
|
||||
)
|
||||
default boolean instance()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "selfColor",
|
||||
name = "Your color",
|
||||
description = "",
|
||||
position = 4
|
||||
)
|
||||
default Color selfColor()
|
||||
{
|
||||
return Color.green;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "totalColor",
|
||||
name = "Total color",
|
||||
description = "",
|
||||
position = 6
|
||||
)
|
||||
default Color totalColor()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "otherColor",
|
||||
name = "Other players color",
|
||||
description = "",
|
||||
position = 5
|
||||
)
|
||||
default Color otherColor()
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "bgColor",
|
||||
name = "Background color",
|
||||
description = "",
|
||||
position = 3
|
||||
)
|
||||
default Color bgColor()
|
||||
{
|
||||
return new Color(70, 61, 50, 156);
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "titleColor",
|
||||
name = "Title color",
|
||||
description = "",
|
||||
position = 2
|
||||
)
|
||||
default Color titleColor()
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package net.runelite.client.plugins.tickcounter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
@@ -18,7 +15,8 @@ import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
public class TickCounterOverlay extends Overlay {
|
||||
public class TickCounterOverlay extends Overlay
|
||||
{
|
||||
|
||||
private TickCounterPlugin plugin;
|
||||
private TickCounterConfig config;
|
||||
@@ -26,7 +24,8 @@ public class TickCounterOverlay extends Overlay {
|
||||
private PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
public TickCounterOverlay(TickCounterPlugin plugin,Client client,TickCounterConfig config) {
|
||||
public TickCounterOverlay(TickCounterPlugin plugin, Client client, TickCounterConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
@@ -37,27 +36,31 @@ public class TickCounterOverlay extends Overlay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D g) {
|
||||
public Dimension render(Graphics2D g)
|
||||
{
|
||||
List<LayoutableRenderableEntity> elems = panelComponent.getChildren();
|
||||
elems.clear();
|
||||
panelComponent.setBackgroundColor(config.bgColor());
|
||||
elems.add(TitleComponent.builder().text("Combat counter").color(config.titleColor()).build());
|
||||
List<Entry<String, Integer>> list = new ArrayList<>(plugin.activity.entrySet());
|
||||
list.sort(new Comparator<Entry<String, Integer>>() {
|
||||
@Override
|
||||
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
|
||||
int value = -Integer.compare(o1.getValue(), o2.getValue());
|
||||
if (value == 0)
|
||||
value = o1.getKey().compareTo(o2.getKey());
|
||||
return value;
|
||||
list.sort((o1, o2) -> {
|
||||
int value = -Integer.compare(o1.getValue(), o2.getValue());
|
||||
if (value == 0)
|
||||
{
|
||||
value = o1.getKey().compareTo(o2.getKey());
|
||||
}
|
||||
return value;
|
||||
});
|
||||
int total = 0;
|
||||
for (Entry<String, Integer> e : list) {
|
||||
for (Entry<String, Integer> e : list)
|
||||
{
|
||||
total += e.getValue();
|
||||
if(e.getKey().equals(client.getLocalPlayer().getName())){
|
||||
if (e.getKey().equals(client.getLocalPlayer().getName()))
|
||||
{
|
||||
elems.add(LineComponent.builder().leftColor(config.selfColor()).rightColor(config.selfColor()).left(e.getKey()).right(e.getValue().toString()).build());
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
elems.add(LineComponent.builder().left(e.getKey()).right(e.getValue().toString()).leftColor(config.otherColor()).rightColor(config.otherColor()).build());
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package net.runelite.client.plugins.tickcounter;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
@@ -23,53 +21,66 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
@PluginDescriptor(name = "Tick Counter",
|
||||
description = "Counts combat activity for nearby players",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVP
|
||||
description = "Counts combat activity for nearby players",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVP
|
||||
)
|
||||
public class TickCounterPlugin extends Plugin {
|
||||
public class TickCounterPlugin extends Plugin
|
||||
{
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private TickCounterConfig config;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Provides
|
||||
TickCounterConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(TickCounterConfig.class);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private TickCounterOverlay overlay;
|
||||
|
||||
Map<String, Integer> activity = new HashMap<>();
|
||||
|
||||
private List<Player> blowpiping = new ArrayList<>();
|
||||
boolean instanced = false;
|
||||
boolean prevInstance = false;
|
||||
private boolean instanced = false;
|
||||
private boolean prevInstance = false;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
activity.clear();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged e) {
|
||||
public void onAnimationChanged(AnimationChanged e)
|
||||
{
|
||||
if (!(e.getActor() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player p = (Player) e.getActor();
|
||||
int weapon = -1;
|
||||
if (p.getPlayerComposition() != null)
|
||||
{
|
||||
weapon = p.getPlayerComposition().getEquipmentId(KitType.WEAPON);
|
||||
}
|
||||
int delta = 0;
|
||||
switch (p.getAnimation()) {
|
||||
switch (p.getAnimation())
|
||||
{
|
||||
case 7617: // rune knife
|
||||
case 8194: // dragon knife
|
||||
case 8291: // dragon knife spec
|
||||
@@ -89,9 +100,13 @@ public class TickCounterPlugin extends Plugin {
|
||||
break;
|
||||
case 426: // bow shoot
|
||||
if (weapon == 20997) // twisted bow
|
||||
{
|
||||
delta = 5;
|
||||
}
|
||||
else // shortbow
|
||||
{
|
||||
delta = 3;
|
||||
}
|
||||
break;
|
||||
case 376: // dds poke
|
||||
case 377: // dds slash
|
||||
@@ -119,7 +134,8 @@ public class TickCounterPlugin extends Plugin {
|
||||
delta = 4;
|
||||
break;
|
||||
case 393: // staff bash
|
||||
if (weapon == 13652) { // claw scratch
|
||||
if (weapon == 13652)
|
||||
{ // claw scratch
|
||||
delta = 4;
|
||||
break;
|
||||
}
|
||||
@@ -135,9 +151,13 @@ public class TickCounterPlugin extends Plugin {
|
||||
break;
|
||||
case 401:
|
||||
if (weapon == 13576) // dwh bop
|
||||
{
|
||||
delta = 6;
|
||||
}
|
||||
else // used by pickaxe and axe
|
||||
{
|
||||
delta = 5;
|
||||
}
|
||||
break;
|
||||
case 1378:
|
||||
case 7045:
|
||||
@@ -158,37 +178,47 @@ public class TickCounterPlugin extends Plugin {
|
||||
case 1203: // chally spec
|
||||
delta = 7;
|
||||
break;
|
||||
case -1:
|
||||
blowpiping.remove(p);
|
||||
break;
|
||||
case -1:
|
||||
blowpiping.remove(p);
|
||||
break;
|
||||
}
|
||||
if (delta > 0) {
|
||||
if (delta > 0)
|
||||
{
|
||||
String name = p.getName();
|
||||
this.activity.put(name, this.activity.getOrDefault(name, 0) + delta);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClientTick(ClientTick e) {
|
||||
public void onClientTick(ClientTick e)
|
||||
{
|
||||
/*
|
||||
* Hack for blowpipe since the AnimationChanged event doesn't fire when using a
|
||||
* blowpipe because of its speed. If blowpipe animation restarts, then add 2
|
||||
*/
|
||||
for (Player p : blowpiping) {
|
||||
for (Player p : blowpiping)
|
||||
{
|
||||
Actor rsp = p;
|
||||
if (rsp.getActionFrame() == 0 && rsp.getActionFrameCycle() == 1) {
|
||||
if (rsp.getActionFrame() == 0 && rsp.getActionFrameCycle() == 1)
|
||||
{
|
||||
String name = p.getName();
|
||||
int activity = this.activity.getOrDefault(name, 0).intValue();
|
||||
int activity = this.activity.getOrDefault(name, 0);
|
||||
this.activity.put(name, activity + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick tick){
|
||||
if(!config.instance())return;
|
||||
public void onGameTick(GameTick tick)
|
||||
{
|
||||
if (!config.instance())
|
||||
{
|
||||
return;
|
||||
}
|
||||
prevInstance = instanced;
|
||||
instanced = client.isInInstancedRegion();
|
||||
if(!prevInstance && instanced){
|
||||
if (!prevInstance && instanced)
|
||||
{
|
||||
activity.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Frosty Fridge <https://github.com/frostyfridge>
|
||||
* 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.vetion;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("vetion")
|
||||
public interface VetionConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "earthquakeTimerActive",
|
||||
name = "Vet'ion Earthquake Timer",
|
||||
description = "Configures whether or not a timer is shown to track the cooldown of Vet'ion's earthquake attack",
|
||||
position = 0
|
||||
)
|
||||
default boolean eartquakeTimerActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.vetion;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
@@ -33,61 +39,57 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
public class VetionOverlay extends Overlay
|
||||
{
|
||||
|
||||
public class VetionOverlay extends Overlay{
|
||||
private static final Color RED_ALPHA = new Color(Color.RED.getRed(), Color.RED.getGreen(), Color.RED.getBlue(), 100);
|
||||
private static final Duration MAX_TIME = Duration.ofSeconds(9);
|
||||
private final VetionPlugin plugin;
|
||||
private Client client;
|
||||
|
||||
private static final Color RED_ALPHA = new Color(Color.RED.getRed(), Color.RED.getGreen(), Color.RED.getBlue(), 100);
|
||||
private static final Duration MAX_TIME = Duration.ofSeconds(9);
|
||||
private final VetionPlugin plugin;
|
||||
private Client client;
|
||||
@Inject
|
||||
private VetionOverlay(Client client, VetionPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
@Inject
|
||||
private VetionOverlay(Client client, VetionPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
plugin.getVetions().forEach((actor, timer) ->
|
||||
{
|
||||
LocalPoint localPos = actor.getLocalLocation();
|
||||
if (localPos != null)
|
||||
{
|
||||
Point position = Perspective.localToCanvas(client, localPos, client.getPlane(),
|
||||
actor.getLogicalHeight() + 96);
|
||||
if (position != null)
|
||||
{
|
||||
position = new Point(position.getX(), position.getY());
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
plugin.getVetions().forEach((actor, timer) ->
|
||||
{
|
||||
LocalPoint localPos = actor.getLocalLocation();
|
||||
if (localPos != null)
|
||||
{
|
||||
Point position = Perspective.localToCanvas(client, localPos, client.getPlane(),
|
||||
actor.getLogicalHeight() + 96);
|
||||
if (position != null)
|
||||
{
|
||||
position = new Point(position.getX(), position.getY());
|
||||
final ProgressPieComponent progressPie = new ProgressPieComponent();
|
||||
progressPie.setDiameter(30);
|
||||
progressPie.setFill(RED_ALPHA);
|
||||
progressPie.setBorderColor(Color.RED);
|
||||
progressPie.setPosition(position);
|
||||
|
||||
final ProgressPieComponent progressPie = new ProgressPieComponent();
|
||||
progressPie.setDiameter(30);
|
||||
progressPie.setFill(RED_ALPHA);
|
||||
progressPie.setBorderColor(Color.RED);
|
||||
progressPie.setPosition(position);
|
||||
final Duration duration = Duration.between(timer, Instant.now());
|
||||
progressPie.setProgress(1 - (duration.compareTo(MAX_TIME) < 0
|
||||
? (double) duration.toMillis() / MAX_TIME.toMillis()
|
||||
: 1));
|
||||
|
||||
final Duration duration = Duration.between(timer, Instant.now());
|
||||
progressPie.setProgress(1 - (duration.compareTo(MAX_TIME) < 0
|
||||
? (double) duration.toMillis() / MAX_TIME.toMillis()
|
||||
: 1));
|
||||
progressPie.render(graphics);
|
||||
if (1 - duration.compareTo(MAX_TIME) < 0)
|
||||
{
|
||||
plugin.getVetions().remove(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
progressPie.render(graphics);
|
||||
if (1 - duration.compareTo(MAX_TIME) < 0)
|
||||
{
|
||||
plugin.getVetions().remove(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,14 @@
|
||||
package net.runelite.client.plugins.vetion;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -35,63 +41,47 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Vetion Helper",
|
||||
description = "Tracks Vet'ion's special attacks",
|
||||
tags = {"bosses", "combat", "pve", "overlay"},
|
||||
type = PluginType.PVM
|
||||
name = "Vetion Helper",
|
||||
description = "Tracks Vet'ion's special attacks",
|
||||
tags = {"bosses", "combat", "pve", "overlay"},
|
||||
type = PluginType.PVM
|
||||
)
|
||||
public class VetionPlugin extends Plugin {
|
||||
public class VetionPlugin extends Plugin
|
||||
{
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private VetionConfig config;
|
||||
@Inject
|
||||
private VetionOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Getter
|
||||
private Map<Actor, Instant> vetions;
|
||||
|
||||
@Inject
|
||||
private VetionOverlay overlay;
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
vetions = new HashMap<>();
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private Map<Actor, Instant> vetions;
|
||||
|
||||
@Provides
|
||||
VetionConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(VetionConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
vetions = new HashMap<>();
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
vetions = null;
|
||||
}
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
vetions = null;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
if (config.eartquakeTimerActive() && event.getActor().getAnimation() == AnimationID.VETION_EARTHQUAKE)
|
||||
{
|
||||
Actor vet = event.getActor();
|
||||
vetions.remove(vet, Instant.now());
|
||||
vetions.put(vet, Instant.now());
|
||||
}
|
||||
}
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
if (event.getActor().getAnimation() == AnimationID.VETION_EARTHQUAKE)
|
||||
{
|
||||
Actor vet = event.getActor();
|
||||
vetions.remove(vet, Instant.now());
|
||||
vetions.put(vet, Instant.now());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ import net.runelite.client.config.ConfigItem;
|
||||
public interface WarIndicatorConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "highLightCallers",
|
||||
name = "Highlight Callers",
|
||||
description = "Highlight listed caller(s)"
|
||||
position = 0,
|
||||
keyName = "highLightCallers",
|
||||
name = "Highlight Callers",
|
||||
description = "Highlight listed caller(s)"
|
||||
)
|
||||
default boolean highLightCallers()
|
||||
{
|
||||
@@ -45,10 +45,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "callerColor",
|
||||
name = "Caller(s) Color",
|
||||
description = "Color to highlight caller's name"
|
||||
position = 1,
|
||||
keyName = "callerColor",
|
||||
name = "Caller(s) Color",
|
||||
description = "Color to highlight caller's name"
|
||||
)
|
||||
default Color getCallerColor()
|
||||
{
|
||||
@@ -56,10 +56,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "callerMinimap",
|
||||
name = "Callers on Minimap",
|
||||
description = "Show your caller(s) on the minimap"
|
||||
position = 2,
|
||||
keyName = "callerMinimap",
|
||||
name = "Callers on Minimap",
|
||||
description = "Show your caller(s) on the minimap"
|
||||
)
|
||||
default boolean callerMinimap()
|
||||
{
|
||||
@@ -68,10 +68,10 @@ public interface WarIndicatorConfig extends Config
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "callerTile",
|
||||
name = "Show Caller's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
position = 3,
|
||||
keyName = "callerTile",
|
||||
name = "Show Caller's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
)
|
||||
default boolean callerTile()
|
||||
{
|
||||
@@ -79,10 +79,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "activeCallers",
|
||||
name = "Callers",
|
||||
description = "Adds a user to your caller list. Format: (caller), (caller)"
|
||||
position = 4,
|
||||
keyName = "activeCallers",
|
||||
name = "Callers",
|
||||
description = "Adds a user to your caller list. Format: (caller), (caller)"
|
||||
)
|
||||
default String getActiveCallers()
|
||||
{
|
||||
@@ -90,19 +90,19 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "activeCallers",
|
||||
name = "",
|
||||
description = ""
|
||||
position = 5,
|
||||
keyName = "activeCallers",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void setActiveCallers(String key);
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "highlightSnipes",
|
||||
name = "Highlight Targets",
|
||||
description = "Highlight listed target(s)"
|
||||
position = 6,
|
||||
keyName = "highlightSnipes",
|
||||
name = "Highlight Targets",
|
||||
description = "Highlight listed target(s)"
|
||||
)
|
||||
default boolean highlightSnipes()
|
||||
{
|
||||
@@ -110,10 +110,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "snipeColor",
|
||||
name = "Target(s) Color",
|
||||
description = "Color to highlight target name"
|
||||
position = 7,
|
||||
keyName = "snipeColor",
|
||||
name = "Target(s) Color",
|
||||
description = "Color to highlight target name"
|
||||
)
|
||||
default Color getSnipeColor()
|
||||
{
|
||||
@@ -121,10 +121,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "snipeMinimap",
|
||||
name = "Targets on Minimap",
|
||||
description = "Show your target on the minimap"
|
||||
position = 8,
|
||||
keyName = "snipeMinimap",
|
||||
name = "Targets on Minimap",
|
||||
description = "Show your target on the minimap"
|
||||
)
|
||||
default boolean snipeMinimap()
|
||||
{
|
||||
@@ -132,10 +132,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "snipeTile",
|
||||
name = "Show Target's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
position = 9,
|
||||
keyName = "snipeTile",
|
||||
name = "Show Target's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
)
|
||||
default boolean snipeTile()
|
||||
{
|
||||
@@ -143,10 +143,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "targetedSnipes",
|
||||
name = "Targets",
|
||||
description = "Adds a user to your snipe list. Format: (target), (target)"
|
||||
position = 10,
|
||||
keyName = "targetedSnipes",
|
||||
name = "Targets",
|
||||
description = "Adds a user to your snipe list. Format: (target), (target)"
|
||||
)
|
||||
default String getTargetedSnipes()
|
||||
{
|
||||
@@ -154,11 +154,10 @@ public interface WarIndicatorConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "targetedSnipes",
|
||||
name = "",
|
||||
description = ""
|
||||
position = 11,
|
||||
keyName = "targetedSnipes",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
|
||||
void setTargetedSnipe(String key);
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -38,6 +37,7 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@Singleton
|
||||
public class WarIndicatorOverlay extends Overlay
|
||||
|
||||
@@ -24,43 +24,28 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.warindicators;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.util.Collection;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.FOLLOW;
|
||||
import static net.runelite.api.MenuAction.ITEM_USE_ON_PLAYER;
|
||||
import static net.runelite.api.MenuAction.PLAYER_EIGTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FIFTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FIRST_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FOURTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SECOND_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
|
||||
import static net.runelite.api.MenuAction.SPELL_CAST_ON_PLAYER;
|
||||
import static net.runelite.api.MenuAction.TRADE;
|
||||
import static net.runelite.api.MenuAction.*;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "War calling indicators",
|
||||
description = "War War War.",
|
||||
tags = {"skill", "total", "max", "PVP"},
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
name = "War calling indicators",
|
||||
description = "War War War.",
|
||||
tags = {"skill", "total", "max", "PVP"},
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class WarIndicatorPlugin extends Plugin
|
||||
{
|
||||
@@ -85,31 +70,31 @@ public class WarIndicatorPlugin extends Plugin
|
||||
return configManager.getConfig(WarIndicatorConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(warIndicatorOverlay);
|
||||
overlayManager.add(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(warIndicatorOverlay);
|
||||
overlayManager.add(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(warIndicatorOverlay);
|
||||
overlayManager.remove(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(warIndicatorOverlay);
|
||||
overlayManager.remove(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdd(MenuEntryAdded menuEntryAdded)
|
||||
public void onMenuEntryAdded(MenuEntryAdded onMenuEntryAdded)
|
||||
{
|
||||
int type = menuEntryAdded.getType();
|
||||
int type = onMenuEntryAdded.getType();
|
||||
|
||||
if (type >= 2000)
|
||||
{
|
||||
type -= 2000;
|
||||
}
|
||||
|
||||
int identifier = menuEntryAdded.getIdentifier();
|
||||
int identifier = onMenuEntryAdded.getIdentifier();
|
||||
if (type == FOLLOW.getId() || type == TRADE.getId()
|
||||
|| type == SPELL_CAST_ON_PLAYER.getId()
|
||||
|| type == ITEM_USE_ON_PLAYER.getId()
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.warindicators;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import java.awt.Color;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.awt.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
|
||||
@Singleton
|
||||
public class WarIndicatorService
|
||||
@@ -62,14 +62,9 @@ public class WarIndicatorService
|
||||
|
||||
String[] targets = config.getTargetedSnipes().split(", ");
|
||||
|
||||
if (targets == null)
|
||||
for (String target : targets)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < targets.length; i++)
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(targets[i]))
|
||||
if (player.getName().equalsIgnoreCase(target))
|
||||
{
|
||||
consumer.accept(player, config.getSnipeColor());
|
||||
}
|
||||
@@ -88,14 +83,9 @@ public class WarIndicatorService
|
||||
|
||||
String[] callers = config.getActiveCallers().split(", ");
|
||||
|
||||
if (callers == null)
|
||||
for (String caller : callers)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < callers.length; i++)
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(callers[i]))
|
||||
if (player.getName().equalsIgnoreCase(caller))
|
||||
{
|
||||
consumer.accept(player, config.getCallerColor());
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
name = "Whale Watchers",
|
||||
description = "A Plugin to save help whales in the wild",
|
||||
tags = {"whale watchers", "whale", "protect item", "warning", "pklite"},
|
||||
type = PluginType.PVP
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class WhaleWatchersPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -28,14 +28,13 @@ public class WildernessLocationsOverlay extends Overlay
|
||||
private WildernessLocationsConfig wildyConfig;
|
||||
|
||||
@Inject
|
||||
public WildernessLocationsOverlay(Client client, WildernessLocationsPlugin plugin)
|
||||
public WildernessLocationsOverlay(WildernessLocationsPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
textComponent = new TextComponent();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,17 +6,16 @@
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package net.runelite.client.plugins.wildernesslocations;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
@@ -34,7 +33,6 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
@@ -42,44 +40,44 @@ import net.runelite.client.util.WildernessLocation;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "Wild Locations",
|
||||
description = "Indicates the players current location in the wild",
|
||||
tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"},
|
||||
type = PluginType.PVP
|
||||
name = "Wild Locations",
|
||||
description = "Indicates the players current location in the wild",
|
||||
tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"},
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class WildernessLocationsPlugin extends Plugin
|
||||
{
|
||||
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
|
||||
@Inject
|
||||
OverlayManager overlayManager;
|
||||
|
||||
|
||||
@Inject
|
||||
private WildernessLocationsOverlay overlay = new WildernessLocationsOverlay(this.client, this);
|
||||
|
||||
private WildernessLocationsOverlay overlay = new WildernessLocationsOverlay(this);
|
||||
|
||||
@Getter
|
||||
private boolean renderLocation;
|
||||
|
||||
|
||||
@Getter
|
||||
private String locationString = "";
|
||||
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
|
||||
@Inject
|
||||
private WildernessLocationsConfig wildyConfig;
|
||||
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
|
||||
private String oldChat = "";
|
||||
private int currentCooldown = 0;
|
||||
private final int COOLDOWN_TICKS = 30;
|
||||
private WorldPoint worldPoint = null;
|
||||
private final HashMap<WorldArea, String> wildLocs = getLocationMap();
|
||||
|
||||
|
||||
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> wildyConfig.keybind())
|
||||
{
|
||||
@Override
|
||||
@@ -88,27 +86,27 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
sendLocToCC();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Provides
|
||||
WildernessLocationsConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(WildernessLocationsConfig.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
keyManager.registerKeyListener(hotkeyListener);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
keyManager.unregisterKeyListener(hotkeyListener);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
@@ -131,7 +129,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
locationString = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String location()
|
||||
{
|
||||
int dist = 10000;
|
||||
@@ -140,7 +138,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
for (Map.Entry<WorldArea, String> entry : wildLocs.entrySet())
|
||||
{
|
||||
WorldArea worldArea = entry.getKey();
|
||||
|
||||
|
||||
if (worldArea.toWorldPointList().contains(client.getLocalPlayer().getWorldLocation()))
|
||||
{
|
||||
s = entry.getValue();
|
||||
@@ -154,7 +152,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
if (client.getLocalPlayer().getWorldLocation().getY() >
|
||||
(Objects.requireNonNull(closestArea).toWorldPoint().getY() + closestArea.getHeight()))
|
||||
(Objects.requireNonNull(closestArea).toWorldPoint().getY() + closestArea.getHeight()))
|
||||
{
|
||||
s = s + "N";
|
||||
}
|
||||
@@ -167,7 +165,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
s = s + "W";
|
||||
}
|
||||
if (client.getLocalPlayer().getWorldLocation().getX() >
|
||||
(closestArea.toWorldPoint().getX() + closestArea.getWidth()))
|
||||
(closestArea.toWorldPoint().getX() + closestArea.getWidth()))
|
||||
{
|
||||
s = s + "E";
|
||||
}
|
||||
@@ -179,15 +177,15 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
private static HashMap<WorldArea, String> getLocationMap()
|
||||
{
|
||||
HashMap<WorldArea, String> hashMap = new HashMap<>();
|
||||
Arrays.stream(WildernessLocation.values()).forEach(wildernessLocation ->
|
||||
hashMap.put(wildernessLocation.getWorldArea(), wildernessLocation.getName()));
|
||||
hashMap.put(wildernessLocation.getWorldArea(), wildernessLocation.getName()));
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onVarClientStrChanged(VarClientStrChanged varClient)
|
||||
{
|
||||
@@ -197,12 +195,12 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
oldChat = newChat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean inClanChat()
|
||||
{
|
||||
return client.getWidget(WidgetInfo.CLAN_CHAT_TITLE) != null;
|
||||
}
|
||||
|
||||
|
||||
private void sendMessage(String text)
|
||||
{
|
||||
int mode = 0;
|
||||
@@ -221,7 +219,7 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
};
|
||||
clientThread.invoke(r);
|
||||
}
|
||||
|
||||
|
||||
private void sendLocToCC()
|
||||
{
|
||||
if (currentCooldown != 0)
|
||||
@@ -234,6 +232,6 @@ public class WildernessLocationsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
sendMessage("/World: " + client.getWorld() + " Location: " + location);
|
||||
currentCooldown = COOLDOWN_TICKS;
|
||||
currentCooldown = 30;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,17 +33,6 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("zulrah")
|
||||
public interface ZulrahConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "zulrahenable",
|
||||
name = "Enable Zulrah Helper",
|
||||
description = "Configures whether or not to enable Zulrah Helper."
|
||||
)
|
||||
default boolean EnableZulrah()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "zulrahprayenable",
|
||||
|
||||
@@ -230,11 +230,6 @@ public class ZulrahPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (!config.EnableZulrah())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (phase4 && phases.size() == 11)
|
||||
{
|
||||
jadphase = 1;
|
||||
|
||||
@@ -48,11 +48,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -62,20 +58,18 @@ import java.util.jar.JarInputStream;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.logging.Logger;
|
||||
import javassist.ClassPool;
|
||||
import javassist.NotFoundException;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import javassist.ClassPool;
|
||||
import javassist.NotFoundException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLite;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.NONE;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA;
|
||||
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.rs.bytecode.ByteCodeUtils;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
import net.runelite.client.rs.bytecode.ByteCodeUtils;
|
||||
import net.runelite.client.rs.bytecode.Hooks;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import okhttp3.Request;
|
||||
@@ -87,10 +81,9 @@ import org.xeustechnologies.jcl.JarClassLoader;
|
||||
@Singleton
|
||||
public class ClientLoader
|
||||
{
|
||||
public static File hooksFile = new File(RuneLite.RUNELITE_DIR+"/hooks-"+ RuneLiteAPI.getVersion() +"-.json");
|
||||
public static File hooksFile = new File(RuneLite.RUNELITE_DIR + "/hooks-" + RuneLiteAPI.getVersion() + "-.json");
|
||||
private final ClientConfigLoader clientConfigLoader;
|
||||
private ClientUpdateCheckMode updateCheckMode;
|
||||
private JarOutputStream target;
|
||||
private static String[] preotectedStuffs;
|
||||
private static int stepCount;
|
||||
|
||||
@@ -114,14 +107,13 @@ public class ClientLoader
|
||||
{
|
||||
File injectedClientFile = ByteCodeUtils.injectedClientFile;
|
||||
File hijackedClientFile = ByteCodeUtils.hijackedClientFile;
|
||||
Manifest manifest = new Manifest();
|
||||
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
target = new JarOutputStream(new FileOutputStream(injectedClientFile), manifest);
|
||||
Manifest manifest = new Manifest();
|
||||
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
JarOutputStream target = new JarOutputStream(new FileOutputStream(injectedClientFile), manifest);
|
||||
RSConfig config = clientConfigLoader.fetch();
|
||||
|
||||
Map<String, byte[]> zipFile = new HashMap<>();
|
||||
{
|
||||
Certificate[] jagexCertificateChain = getJagexCertificateChain();
|
||||
String codebase = config.getCodeBase();
|
||||
String initialJar = config.getInitialJar();
|
||||
URL url = new URL(codebase + initialJar);
|
||||
@@ -133,7 +125,7 @@ public class ClientLoader
|
||||
{
|
||||
JarInputStream jis;
|
||||
|
||||
jis = new JarInputStream(response.body().byteStream());
|
||||
jis = new JarInputStream(response.body().byteStream());
|
||||
|
||||
byte[] tmp = new byte[4096];
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024);
|
||||
@@ -161,118 +153,132 @@ public class ClientLoader
|
||||
}
|
||||
}
|
||||
|
||||
if (updateCheckMode == AUTO)
|
||||
if (updateCheckMode == AUTO)
|
||||
{
|
||||
Map<String, String> hashes;
|
||||
try (InputStream is = ClientLoader.class.getResourceAsStream("/patch/hashes.json"))
|
||||
{
|
||||
Map<String, String> hashes;
|
||||
try (InputStream is = ClientLoader.class.getResourceAsStream("/patch/hashes.json"))
|
||||
hashes = new Gson().fromJson(new InputStreamReader(is), new TypeToken<HashMap<String, String>>()
|
||||
{
|
||||
hashes = new Gson().fromJson(new InputStreamReader(is), new TypeToken<HashMap<String, String>>()
|
||||
{
|
||||
}.getType());
|
||||
}.getType());
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> file : hashes.entrySet())
|
||||
{
|
||||
byte[] bytes = zipFile.get(file.getKey());
|
||||
|
||||
String ourHash = null;
|
||||
if (bytes != null)
|
||||
{
|
||||
ourHash = Hashing.sha512().hashBytes(bytes).toString();
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> file : hashes.entrySet())
|
||||
if (!file.getValue().equals(ourHash))
|
||||
{
|
||||
byte[] bytes = zipFile.get(file.getKey());
|
||||
|
||||
String ourHash = null;
|
||||
if (bytes != null)
|
||||
if (hijackedClientFile.exists())
|
||||
{
|
||||
ourHash = Hashing.sha512().hashBytes(bytes).toString();
|
||||
Logger.getAnonymousLogger().warning("[RuneLitePlus] Hash checking / Client patching skipped due to hijacked client.");
|
||||
updateCheckMode = VANILLA;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!file.getValue().equals(ourHash))
|
||||
else
|
||||
{
|
||||
if (hijackedClientFile.exists()) {
|
||||
Logger.getAnonymousLogger().warning("[RuneLitePlus] Hash checking / Client patching skipped due to hijacked client.");
|
||||
updateCheckMode = VANILLA;
|
||||
break;
|
||||
} else {
|
||||
log.info("{} had a hash mismatch; falling back to vanilla. {} != {}", file.getKey(), file.getValue(), ourHash);
|
||||
log.info("Client is outdated!");
|
||||
updateCheckMode = VANILLA;
|
||||
break;
|
||||
}
|
||||
log.info("{} had a hash mismatch; falling back to vanilla. {} != {}", file.getKey(), file.getValue(), ourHash);
|
||||
log.info("Client is outdated!");
|
||||
updateCheckMode = VANILLA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateCheckMode == AUTO)
|
||||
if (updateCheckMode == AUTO)
|
||||
{
|
||||
ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024);
|
||||
int patchCount = 0;
|
||||
|
||||
for (Map.Entry<String, byte[]> file : zipFile.entrySet())
|
||||
{
|
||||
ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024);
|
||||
int patchCount = 0;
|
||||
|
||||
for (Map.Entry<String, byte[]> file : zipFile.entrySet())
|
||||
byte[] bytes;
|
||||
try (InputStream is = ClientLoader.class.getResourceAsStream("/patch/" + file.getKey() + ".bs"))
|
||||
{
|
||||
byte[] bytes;
|
||||
try (InputStream is = ClientLoader.class.getResourceAsStream("/patch/" + file.getKey() + ".bs"))
|
||||
if (is == null)
|
||||
{
|
||||
if (is == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bytes = ByteStreams.toByteArray(is);
|
||||
continue;
|
||||
}
|
||||
|
||||
patchOs.reset();
|
||||
Patch.patch(file.getValue(), bytes, patchOs);
|
||||
file.setValue(patchOs.toByteArray());
|
||||
|
||||
++patchCount;
|
||||
|
||||
if (!file.getKey().startsWith("META")) {
|
||||
add(file.getValue(), file.getKey(), target);
|
||||
}
|
||||
bytes = ByteStreams.toByteArray(is);
|
||||
}
|
||||
if (target!=null)
|
||||
target.close();
|
||||
|
||||
log.info("Patched {} classes", patchCount);
|
||||
patchOs.reset();
|
||||
Patch.patch(file.getValue(), bytes, patchOs);
|
||||
file.setValue(patchOs.toByteArray());
|
||||
|
||||
++patchCount;
|
||||
|
||||
if (!file.getKey().startsWith("META"))
|
||||
{
|
||||
add(file.getValue(), file.getKey(), target);
|
||||
}
|
||||
}
|
||||
if (hooksFile.exists()) {
|
||||
ByteCodePatcher.classPool = new ClassPool(true);
|
||||
ByteCodePatcher.classPool.appendClassPath(RuneLite.RUNELITE_DIR+"/injectedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
Gson gson = new Gson();
|
||||
Hooks hooks = gson.fromJson(new BufferedReader(new FileReader(hooksFile)), Hooks.class);
|
||||
target.close();
|
||||
|
||||
if (hooks.clientInstance.equals("")||
|
||||
hooks.projectileClass.equals("") ||
|
||||
hooks.actorClass.equals("") ||
|
||||
hooks.playerClass.equals("")) {
|
||||
System.out.println("[RuneLitePlus] Bad hooks, re-scraping.");
|
||||
stepCount = getStepCount(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.clientInstance = initHookScrape(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.findHooks(injectedClientFile.getPath());
|
||||
} else {
|
||||
ByteCodePatcher.clientInstance = hooks.clientInstance;
|
||||
ByteCodePatcher.applyHooks(ByteCodeUtils.injectedClientFile, hooks);
|
||||
System.out.println("[RuneLitePlus] Loaded hooks");
|
||||
}
|
||||
log.info("Patched {} classes", patchCount);
|
||||
}
|
||||
if (hooksFile.exists())
|
||||
{
|
||||
ByteCodePatcher.classPool = new ClassPool(true);
|
||||
ByteCodePatcher.classPool.appendClassPath(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
Gson gson = new Gson();
|
||||
Hooks hooks = gson.fromJson(new BufferedReader(new FileReader(hooksFile)), Hooks.class);
|
||||
|
||||
} else {
|
||||
System.out.println("[RuneLitePlus] Hooks file not found, scraping hooks.");
|
||||
if (hooks.clientInstance.equals("") ||
|
||||
hooks.clientClass.equals("") ||
|
||||
hooks.projectileClass.equals("") ||
|
||||
hooks.actorClass.equals("") ||
|
||||
hooks.playerClass.equals(""))
|
||||
{
|
||||
log.info("[RuneLitePlus] Bad hooks, re-scraping.");
|
||||
stepCount = getStepCount(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.clientInstance = initHookScrape(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.hooks.protectedStuff = preotectedStuffs;
|
||||
ByteCodePatcher.findHooks(injectedClientFile.getPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
ByteCodePatcher.clientInstance = hooks.clientInstance;
|
||||
ByteCodePatcher.applyHooks(ByteCodeUtils.injectedClientFile, hooks);
|
||||
log.info("[RuneLitePlus] Loaded hooks");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("[RuneLitePlus] Hooks file not found, scraping hooks.");
|
||||
stepCount = getStepCount(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.clientInstance = initHookScrape(ByteCodeUtils.injectedClientFile.getPath());
|
||||
ByteCodePatcher.hooks.protectedStuff = preotectedStuffs;
|
||||
ByteCodePatcher.findHooks(injectedClientFile.getPath());
|
||||
}
|
||||
|
||||
Map<String, byte[]> zipFile2 = new HashMap<>();
|
||||
JarInputStream jis = new JarInputStream(new FileInputStream(hijackedClientFile));
|
||||
|
||||
byte[] tmp = new byte[4096];
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024);
|
||||
for (; ; ) {
|
||||
for (; ; )
|
||||
{
|
||||
JarEntry metadata = jis.getNextJarEntry();
|
||||
if (metadata == null) {
|
||||
if (metadata == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
buffer.reset();
|
||||
for (; ; ) {
|
||||
for (; ; )
|
||||
{
|
||||
int n = jis.read(tmp);
|
||||
if (n <= -1) {
|
||||
if (n <= -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
buffer.write(tmp, 0, n);
|
||||
@@ -306,7 +312,7 @@ public class ClientLoader
|
||||
return rs;
|
||||
}
|
||||
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
|
||||
| CompressorException | InvalidHeaderException | CertificateException | SecurityException e)
|
||||
| CompressorException | InvalidHeaderException | SecurityException e)
|
||||
{
|
||||
if (e instanceof ClassNotFoundException)
|
||||
{
|
||||
@@ -317,142 +323,175 @@ public class ClientLoader
|
||||
|
||||
log.error("Error loading RS!", e);
|
||||
return null;
|
||||
} catch (NotFoundException e) {
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void add(byte[] bytes, String entryName ,JarOutputStream target) throws IOException {
|
||||
BufferedInputStream in = null;
|
||||
try {
|
||||
JarEntry entry = new JarEntry(entryName);
|
||||
target.putNextEntry(entry);
|
||||
target.write(bytes);
|
||||
target.closeEntry();
|
||||
} finally {
|
||||
if (in != null)
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static Certificate[] getJagexCertificateChain() throws CertificateException
|
||||
private void add(byte[] bytes, String entryName, JarOutputStream target) throws IOException
|
||||
{
|
||||
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
|
||||
Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt"));
|
||||
return certificates.toArray(new Certificate[certificates.size()]);
|
||||
JarEntry entry = new JarEntry(entryName);
|
||||
target.putNextEntry(entry);
|
||||
target.write(bytes);
|
||||
target.closeEntry();
|
||||
}
|
||||
|
||||
public static int getStepCount(String jarFile) {
|
||||
private static int getStepCount(String jarFile)
|
||||
{
|
||||
int stepCount = 0;
|
||||
JarClassLoader jcl = new JarClassLoader();
|
||||
try {
|
||||
try
|
||||
{
|
||||
ClassPool classPool = new ClassPool(true);
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR+"/injectedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
} catch (NotFoundException e) {
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
jcl.add(new FileInputStream(jarFile));
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jarFile)))) {
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jarFile))))
|
||||
{
|
||||
JarEntry entry;
|
||||
while ((entry = in.getNextJarEntry()) != null) {
|
||||
if (entry.getName().endsWith(".class")) {
|
||||
while ((entry = in.getNextJarEntry()) != null)
|
||||
{
|
||||
if (entry.getName().endsWith(".class"))
|
||||
{
|
||||
stepCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return stepCount;
|
||||
}
|
||||
|
||||
public static String initHookScrape(String jarFile) {
|
||||
private static String initHookScrape(String jarFile)
|
||||
{
|
||||
int currentStep = 0;
|
||||
RuneLite.splashScreen.setMessage("Analyzing injected client");
|
||||
List protectedStuff = new ArrayList<String>();
|
||||
List<String> protectedStuff = new ArrayList<>();
|
||||
String clientInstance = "";
|
||||
JarClassLoader jcl = new JarClassLoader();
|
||||
try {
|
||||
ClassPool classPool = new ClassPool(true);
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR+"/injectedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JarClassLoader jcl = new JarClassLoader();
|
||||
try
|
||||
{
|
||||
ClassPool classPool = new ClassPool(true);
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
jcl.add(new FileInputStream(jarFile));
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jarFile)))) {
|
||||
JarEntry entry;
|
||||
while ((entry = in.getNextJarEntry()) != null) {
|
||||
if (entry.getName().endsWith(".class")) {
|
||||
File temp = new File(jarFile);
|
||||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
try {
|
||||
URLClassLoader child = new URLClassLoader(
|
||||
new URL[] {temp.toURI().toURL()},
|
||||
cl
|
||||
);
|
||||
try {
|
||||
Class classToLoad = Class.forName(entry.getName().replace(".class", ""), false, child);
|
||||
RuneLite.splashScreen.setSubMessage(entry.getName());
|
||||
currentStep++;
|
||||
RuneLite.splashScreen.setProgress(currentStep, stepCount);
|
||||
JarClassLoader jcl2 = new JarClassLoader();
|
||||
try {
|
||||
jcl2.add(new FileInputStream(ByteCodeUtils.injectedClientFile));
|
||||
Field[] fields = classToLoad.getDeclaredFields();
|
||||
Method[] methods = classToLoad.getDeclaredMethods();
|
||||
for (Field f : fields) {
|
||||
try {
|
||||
if (f.getName().contains("$")) {
|
||||
System.out.println(classToLoad.getName()+"."+f.getName());
|
||||
protectedStuff.add(classToLoad.getName()+"."+f.getName());
|
||||
try
|
||||
{
|
||||
jcl.add(new FileInputStream(jarFile));
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jarFile))))
|
||||
{
|
||||
JarEntry entry;
|
||||
while ((entry = in.getNextJarEntry()) != null)
|
||||
{
|
||||
if (entry.getName().endsWith(".class"))
|
||||
{
|
||||
File temp = new File(jarFile);
|
||||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
try
|
||||
{
|
||||
URLClassLoader child = new URLClassLoader(
|
||||
new URL[]{temp.toURI().toURL()},
|
||||
cl
|
||||
);
|
||||
try
|
||||
{
|
||||
Class classToLoad = Class.forName(entry.getName().replace(".class", ""), false, child);
|
||||
RuneLite.splashScreen.setSubMessage(entry.getName());
|
||||
currentStep++;
|
||||
RuneLite.splashScreen.setProgress(currentStep, stepCount);
|
||||
JarClassLoader jcl2 = new JarClassLoader();
|
||||
try
|
||||
{
|
||||
jcl2.add(new FileInputStream(ByteCodeUtils.injectedClientFile));
|
||||
Field[] fields = classToLoad.getDeclaredFields();
|
||||
Method[] methods = classToLoad.getDeclaredMethods();
|
||||
for (Field f : fields)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.getName().contains("$"))
|
||||
{
|
||||
log.info(classToLoad.getName() + "." + f.getName());
|
||||
protectedStuff.add(classToLoad.getName() + "." + f.getName());
|
||||
}
|
||||
if (f.getType().getName()=="client") {
|
||||
ByteCodePatcher.hooks.clientInstance = classToLoad.getName()+"."+f.getName();
|
||||
clientInstance = classToLoad.getName()+"."+f.getName();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (Method m : methods) {
|
||||
RuneLite.splashScreen.setSubMessage("Checked "+m.getName());
|
||||
if (m.getName().contains("$")) {
|
||||
protectedStuff.add(classToLoad.getName()+"."+m.getName());
|
||||
if (f.getType().getName().equals("client"))
|
||||
{
|
||||
ByteCodePatcher.hooks.clientInstance = classToLoad.getName() + "." + f.getName();
|
||||
clientInstance = classToLoad.getName() + "." + f.getName();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
RuneLite.splashScreen.setProgress(currentStep, stepCount);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (Method m : methods)
|
||||
{
|
||||
RuneLite.splashScreen.setSubMessage("Checked " + m.getName());
|
||||
if (m.getName().contains("$"))
|
||||
{
|
||||
protectedStuff.add(classToLoad.getName() + "." + m.getName());
|
||||
}
|
||||
}
|
||||
RuneLite.splashScreen.setProgress(currentStep, stepCount);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
RuneLite.splashScreen.setProgress(2, 5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Class not found: "+entry.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int i = 0;
|
||||
for (Object o : protectedStuff) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
log.info("Class not found: " + entry.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (String ignored : protectedStuff)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
preotectedStuffs = new String[i];
|
||||
i = 0;
|
||||
for (Object o : protectedStuff) {
|
||||
preotectedStuffs[i] = (String) o;
|
||||
|
||||
preotectedStuffs = new String[i];
|
||||
i = 0;
|
||||
|
||||
for (String o : protectedStuff)
|
||||
{
|
||||
preotectedStuffs[i] = o;
|
||||
i++;
|
||||
}
|
||||
return clientInstance;
|
||||
}
|
||||
|
||||
return clientInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,6 @@ package net.runelite.client.rs.bytecode;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.rs.ClientLoader;
|
||||
import net.runelite.client.rs.bytecode.transformers.ActorTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ClientTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ErrorTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.PlayerTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ProjectileTransform;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import org.xeustechnologies.jcl.JarClassLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -29,200 +15,284 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.rs.ClientLoader;
|
||||
import net.runelite.client.rs.bytecode.transformers.ActorTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ClientTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ErrorTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.PlayerTransform;
|
||||
import net.runelite.client.rs.bytecode.transformers.ProjectileTransform;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import org.xeustechnologies.jcl.JarClassLoader;
|
||||
|
||||
public class ByteCodePatcher {
|
||||
@Slf4j
|
||||
public class ByteCodePatcher
|
||||
{
|
||||
|
||||
public static List<CtClass> modifiedClasses = new ArrayList<>();
|
||||
public static Hooks hooks = new Hooks();
|
||||
public static String clientInstance;
|
||||
public static JarClassLoader jcl = new JarClassLoader();
|
||||
private static JarClassLoader jcl = new JarClassLoader();
|
||||
public static ClassPool classPool = null;
|
||||
public static ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
public static int classCount = 0;
|
||||
private static ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||
private static int classCount = 0;
|
||||
|
||||
public static void applyHooks(File jf, Hooks hooks) {
|
||||
public static void applyHooks(File jf, Hooks hooks)
|
||||
{
|
||||
RuneLite.splashScreen.setProgress(0, 5);
|
||||
RuneLite.splashScreen.setMessage("Applying cached bytecode patches...");
|
||||
try {
|
||||
try
|
||||
{
|
||||
URLClassLoader child = new URLClassLoader(
|
||||
new URL[] {jf.toURI().toURL()},
|
||||
cl
|
||||
new URL[]{jf.toURI().toURL()},
|
||||
cl
|
||||
);
|
||||
try {
|
||||
try
|
||||
{
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Client");
|
||||
Class clientClass = Class.forName(hooks.clientClass, false, child);
|
||||
transformClient(clientClass);
|
||||
RuneLite.splashScreen.setProgress(1, 5);
|
||||
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Actor");
|
||||
Class actorClass = Class.forName(hooks.actorClass, false, child);
|
||||
transformActor(actorClass);
|
||||
RuneLite.splashScreen.setProgress(1, 5);
|
||||
RuneLite.splashScreen.setProgress(2, 5);
|
||||
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Projectile");
|
||||
Class projectileClass = Class.forName(hooks.projectileClass, false, child);
|
||||
transformProjectile(projectileClass);
|
||||
RuneLite.splashScreen.setProgress(2, 5);
|
||||
RuneLite.splashScreen.setProgress(3, 5);
|
||||
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Player");
|
||||
Class playerClass = Class.forName(hooks.playerClass, false, child);
|
||||
transformPlayer(playerClass);
|
||||
RuneLite.splashScreen.setProgress(3, 5);
|
||||
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Client");
|
||||
Class clientClass = Class.forName("client", false, child);
|
||||
transformClient(clientClass);
|
||||
RuneLite.splashScreen.setProgress(4, 5);
|
||||
|
||||
//Odds and ends
|
||||
// Odds and ends
|
||||
RuneLite.splashScreen.setSubMessage("Transforming Error method");
|
||||
ErrorTransform et = new ErrorTransform();
|
||||
et.modify(null);
|
||||
transformStackTrace();
|
||||
RuneLite.splashScreen.setProgress(5, 5);
|
||||
|
||||
RuneLite.splashScreen.setSubMessage("");
|
||||
ByteCodeUtils.updateHijackedJar();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void findHooks(String jf) {
|
||||
public static void findHooks(String jf)
|
||||
{
|
||||
RuneLite.splashScreen.setMessage("Hijacking Classes");
|
||||
try {
|
||||
try
|
||||
{
|
||||
classPool = new ClassPool(true);
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR+"/injectedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
} catch (NotFoundException e) {
|
||||
classPool.appendClassPath(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
jcl.add(new FileInputStream(jf));
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jf)))) {
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jf))))
|
||||
{
|
||||
JarEntry entry;
|
||||
while ((entry = in.getNextJarEntry()) != null) {
|
||||
if (entry.getName().endsWith(".class")) {
|
||||
while ((entry = in.getNextJarEntry()) != null)
|
||||
{
|
||||
if (entry.getName().endsWith(".class"))
|
||||
{
|
||||
classCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
jcl.add(new FileInputStream(jf));
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jf)))) {
|
||||
try (JarInputStream in = new JarInputStream(new BufferedInputStream(new FileInputStream(jf))))
|
||||
{
|
||||
JarEntry entry;
|
||||
while ((entry = in.getNextJarEntry()) != null) {
|
||||
if (entry.getName().endsWith(".class")) {
|
||||
while ((entry = in.getNextJarEntry()) != null)
|
||||
{
|
||||
if (entry.getName().endsWith(".class"))
|
||||
{
|
||||
RuneLite.splashScreen.setProgress(i, classCount);
|
||||
RuneLite.splashScreen.setSubMessage("Checking "+entry.getName());
|
||||
RuneLite.splashScreen.setSubMessage("Checking " + entry.getName());
|
||||
checkClasses(new File(jf), entry);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
try {
|
||||
try
|
||||
{
|
||||
Writer writer = new FileWriter(ClientLoader.hooksFile);
|
||||
gson.toJson(hooks, writer);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
ByteCodeUtils.updateHijackedJar();
|
||||
}
|
||||
|
||||
public static void checkClasses(File jf, JarEntry entry) {
|
||||
try {
|
||||
private static void checkClasses(File jf, JarEntry entry)
|
||||
{
|
||||
try
|
||||
{
|
||||
URLClassLoader child = new URLClassLoader(
|
||||
new URL[] {jf.toURI().toURL()},
|
||||
cl
|
||||
new URL[]{jf.toURI().toURL()},
|
||||
cl
|
||||
);
|
||||
try {
|
||||
try
|
||||
{
|
||||
Class classToLoad = Class.forName(entry.getName().replace(".class", ""), false, child);
|
||||
checkClient(classToLoad);
|
||||
checkActor(classToLoad);
|
||||
checkProjectile(classToLoad);
|
||||
checkPlayer(classToLoad);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Class not found: "+entry.getName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
// System.out.println("Class not found: "+entry.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkActor(Class current) {
|
||||
try {
|
||||
Method method = current.getDeclaredMethod("setCombatInfo", new Class[] { int.class, int.class, int.class, int.class, int.class, int.class });
|
||||
if (method!=null) {
|
||||
private static void checkClient(Class current)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = current.getDeclaredMethod("getProjectiles");
|
||||
if (method != null)
|
||||
{
|
||||
hooks.clientClass = current.getName();
|
||||
log.info("[RuneLitePlus] Transforming Client at class: " + current.getName());
|
||||
ClientTransform ct = new ClientTransform();
|
||||
ct.modify(current);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException | NoClassDefFoundError e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void transformClient(Class client)
|
||||
{
|
||||
log.info("[RuneLitePlus] Transforming Client at class: " + client.getName());
|
||||
ClientTransform ct = new ClientTransform();
|
||||
ct.modify(client);
|
||||
}
|
||||
|
||||
private static void checkActor(Class current)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = current.getDeclaredMethod("setCombatInfo", new Class[]{int.class, int.class, int.class, int.class, int.class, int.class});
|
||||
if (method != null)
|
||||
{
|
||||
hooks.actorClass = current.getName();
|
||||
System.out.println("[RuneLitePlus] Transforming Actor at class: "+current.getName());
|
||||
log.info("[RuneLitePlus] Transforming Actor at class: " + current.getName());
|
||||
ActorTransform at = new ActorTransform();
|
||||
at.modify(current);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
//e.printStackTrace();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
catch (NoSuchMethodException | NoClassDefFoundError e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void transformActor(Class actor) {
|
||||
System.out.println("[RuneLitePlus] Transforming Actor at class: "+actor.getName());
|
||||
private static void transformActor(Class actor)
|
||||
{
|
||||
log.info("[RuneLitePlus] Transforming Actor at class: " + actor.getName());
|
||||
ActorTransform at = new ActorTransform();
|
||||
at.modify(actor);
|
||||
}
|
||||
|
||||
public static void checkProjectile(Class current) {
|
||||
try {
|
||||
Method method = current.getDeclaredMethod("projectileMoved", new Class[] { int.class, int.class, int.class, int.class});
|
||||
if (method!=null) {
|
||||
private static void checkProjectile(Class current)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = current.getDeclaredMethod("projectileMoved", new Class[]{int.class, int.class, int.class, int.class});
|
||||
if (method != null)
|
||||
{
|
||||
hooks.projectileClass = current.getName();
|
||||
System.out.println("[RuneLitePlus] Transforming Projectile at class: "+current.getName());
|
||||
log.info("[RuneLitePlus] Transforming Projectile at class: " + current.getName());
|
||||
ProjectileTransform pt = new ProjectileTransform();
|
||||
pt.modify(current);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
//e.printStackTrace();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
catch (NoSuchMethodException | NoClassDefFoundError e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void transformProjectile(Class projectile) {
|
||||
System.out.println("[RuneLitePlus] Transforming Projectile at class: "+projectile.getName());
|
||||
private static void transformProjectile(Class projectile)
|
||||
{
|
||||
log.info("[RuneLitePlus] Transforming Projectile at class: " + projectile.getName());
|
||||
ProjectileTransform pt = new ProjectileTransform();
|
||||
pt.modify(projectile);
|
||||
}
|
||||
|
||||
public static void checkPlayer(Class current) {
|
||||
try {
|
||||
private static void checkPlayer(Class current)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method method = current.getDeclaredMethod("getSkullIcon");
|
||||
if (method!=null) {
|
||||
if (method != null)
|
||||
{
|
||||
hooks.playerClass = current.getName();
|
||||
System.out.println("[RuneLitePlus] Transforming Player at class: "+current.getName());
|
||||
log.info("[RuneLitePlus] Transforming Player at class: " + current.getName());
|
||||
PlayerTransform pt = new PlayerTransform();
|
||||
pt.modify(current);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
//e.printStackTrace();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
catch (NoSuchMethodException | NoClassDefFoundError e)
|
||||
{
|
||||
// e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void transformPlayer(Class player) {
|
||||
System.out.println("[RuneLitePlus] Transforming Player at class: "+player.getName());
|
||||
private static void transformPlayer(Class player)
|
||||
{
|
||||
log.info("[RuneLitePlus] Transforming Player at class: " + player.getName());
|
||||
PlayerTransform pt = new PlayerTransform();
|
||||
pt.modify(player);
|
||||
}
|
||||
|
||||
public static void transformClient(Class clazz) {
|
||||
System.out.println("[RuneLitePlus] Transforming Client");
|
||||
ClientTransform bt = new ClientTransform();
|
||||
bt.modify(clazz);
|
||||
private static void transformStackTrace()
|
||||
{
|
||||
log.info("[RuneLitePlus] Transforming Stack Trace");
|
||||
ErrorTransform et = new ErrorTransform();
|
||||
et.modify(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package net.runelite.client.rs.bytecode;
|
||||
|
||||
import javassist.CtClass;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -19,99 +15,127 @@ import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import javassist.CtClass;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
|
||||
public class ByteCodeUtils {
|
||||
//TODO: Write method to delete old revision injected clients.
|
||||
public static File injectedClientFile = new File(RuneLite.RUNELITE_DIR+"/injectedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
public static File hijackedClientFile = new File(RuneLite.RUNELITE_DIR+"/hijackedClient-"+ RuneLiteAPI.getVersion() +"-.jar");
|
||||
public class ByteCodeUtils
|
||||
{
|
||||
//TODO: Write method to delete old revision injected clients.
|
||||
public static File injectedClientFile = new File(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
public static File hijackedClientFile = new File(RuneLite.RUNELITE_DIR + "/hijackedClient-" + RuneLiteAPI.getVersion() + "-.jar");
|
||||
|
||||
public static JarOutputStream target;
|
||||
public static JarOutputStream target;
|
||||
|
||||
public static void updateHijackedJar() {
|
||||
Manifest manifest = new Manifest();
|
||||
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
try {
|
||||
target = new JarOutputStream(new FileOutputStream(hijackedClientFile), manifest);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
List<String> classesToSkip = new ArrayList<>();
|
||||
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
|
||||
classesToSkip.add(ct.getName());
|
||||
}
|
||||
static void updateHijackedJar()
|
||||
{
|
||||
Manifest manifest = new Manifest();
|
||||
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
|
||||
try
|
||||
{
|
||||
target = new JarOutputStream(new FileOutputStream(hijackedClientFile), manifest);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
try
|
||||
{
|
||||
JarFile original = new JarFile(injectedClientFile);
|
||||
Enumeration<JarEntry> entries = original.entries();
|
||||
while (entries.hasMoreElements())
|
||||
{
|
||||
JarEntry entry = entries.nextElement();
|
||||
boolean skip = false;
|
||||
for (CtClass ct : ByteCodePatcher.modifiedClasses)
|
||||
{
|
||||
if ((ct.getName() + ".class").equals(entry.getName()))
|
||||
{
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
if (!skip)
|
||||
{
|
||||
add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
JarFile original = new JarFile(injectedClientFile);
|
||||
Enumeration<JarEntry> entries = original.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry entry = entries.nextElement();
|
||||
boolean skip = false;
|
||||
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
|
||||
if ((ct.getName()+".class").equals(entry.getName())) {
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
if (!skip)
|
||||
add(entry);
|
||||
}
|
||||
for (CtClass ct : ByteCodePatcher.modifiedClasses)
|
||||
{
|
||||
add(ct);
|
||||
}
|
||||
|
||||
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
|
||||
add(ct);
|
||||
}
|
||||
target.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
target.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private static void add(CtClass ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
JarEntry newEntry = new JarEntry(ct.getName() + ".class");
|
||||
target.putNextEntry(newEntry);
|
||||
target.write(ct.toBytecode());
|
||||
target.closeEntry();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void add(CtClass ct) {
|
||||
try {
|
||||
JarEntry newEntry = new JarEntry(ct.getName()+".class");
|
||||
target.putNextEntry(newEntry);
|
||||
target.write(ct.toBytecode());
|
||||
target.closeEntry();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private static void add(JarEntry entry) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!entry.getName().startsWith("META") && !entry.getName().equals(""))
|
||||
{
|
||||
target.putNextEntry(entry);
|
||||
target.write(getBytesFromZipFile(entry.getName()));
|
||||
target.closeEntry();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void add(JarEntry entry) throws IOException {
|
||||
try {
|
||||
if (!entry.getName().startsWith("META")&&!entry.getName().equals("")) {
|
||||
target.putNextEntry(entry);
|
||||
target.write(getBytesFromZipFile(entry.getName()));
|
||||
target.closeEntry();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private static byte[] getBytesFromZipFile(String entryName)
|
||||
{
|
||||
ZipFile zipFile;
|
||||
try
|
||||
{
|
||||
zipFile = new ZipFile(injectedClientFile);
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
|
||||
public static byte[] getBytesFromZipFile(String entryName) {
|
||||
ZipFile zipFile;
|
||||
try {
|
||||
zipFile = new ZipFile(injectedClientFile);
|
||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
while (entries.hasMoreElements())
|
||||
{
|
||||
ZipEntry entry = entries.nextElement();
|
||||
if (entry.getName().equals(entryName))
|
||||
{
|
||||
InputStream stream = zipFile.getInputStream(entry);
|
||||
|
||||
while(entries.hasMoreElements()){
|
||||
ZipEntry entry = entries.nextElement();
|
||||
if (entry.getName().equals(entryName)) {
|
||||
InputStream stream = zipFile.getInputStream(entry);
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
int nRead;
|
||||
byte[] data = new byte[1024];
|
||||
while ((nRead = stream.read(data, 0, data.length)) != -1) {
|
||||
buffer.write(data, 0, nRead);
|
||||
}
|
||||
buffer.flush();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
int nRead;
|
||||
byte[] data = new byte[1024];
|
||||
while ((nRead = stream.read(data, 0, data.length)) != -1)
|
||||
{
|
||||
buffer.write(data, 0, nRead);
|
||||
}
|
||||
buffer.flush();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ public class Hooks {
|
||||
public String projectileClass = "";
|
||||
public String playerClass = "";
|
||||
public String[] protectedStuff;
|
||||
public String clientClass = "";
|
||||
|
||||
public Hooks() {
|
||||
}
|
||||
|
||||
@@ -5,66 +5,102 @@ import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
import javassist.CtNewMethod;
|
||||
import javassist.NotFoundException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
|
||||
public class ActorTransform implements Transform {
|
||||
private CtClass ct;
|
||||
@Slf4j
|
||||
public class ActorTransform implements Transform
|
||||
{
|
||||
private CtClass ct;
|
||||
|
||||
@Override
|
||||
public void modify(Class actor) {
|
||||
try {
|
||||
ct = ByteCodePatcher.classPool.get(actor.getName());
|
||||
|
||||
transformGetAnimation();
|
||||
transformAnimationChanged();
|
||||
transformGraphicChanged();
|
||||
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
} catch (CannotCompileException | NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void transformGetAnimation() throws CannotCompileException, NotFoundException
|
||||
@Override
|
||||
public void modify(Class actor)
|
||||
{
|
||||
CtMethod protectedAnimation = ct.getDeclaredMethod("1protect$getRsAnimation");
|
||||
ct.removeMethod(protectedAnimation);
|
||||
try
|
||||
{
|
||||
ct = ByteCodePatcher.classPool.get(actor.getName());
|
||||
|
||||
protectedAnimation.setName("getRsAnimation");
|
||||
ct.addMethod(protectedAnimation);
|
||||
transformGetAnimation();
|
||||
transformAnimationChanged();
|
||||
transformGraphicChanged();
|
||||
|
||||
CtMethod getAnimation = ct.getDeclaredMethod("getAnimation");
|
||||
ct.removeMethod(getAnimation);
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
}
|
||||
catch (CannotCompileException | NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
getAnimation = CtNewMethod.make("public int getAnimation() { return this.getRsAnimation(); }",ct);
|
||||
ct.addMethod(getAnimation);
|
||||
}
|
||||
|
||||
|
||||
private void transformAnimationChanged() throws CannotCompileException, NotFoundException
|
||||
private void transformGetAnimation() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod getAnimationChanged = ct.getDeclaredMethod("animationChanged", new CtClass[]{CtClass.intType});
|
||||
ct.removeMethod(getAnimationChanged);
|
||||
CtMethod protectedAnimation = ct.getDeclaredMethod("1protect$getRsAnimation");
|
||||
ct.removeMethod(protectedAnimation);
|
||||
|
||||
getAnimationChanged = CtNewMethod.make(
|
||||
"public void animationChanged(int n) { " +
|
||||
"net.runelite.api.events.AnimationChanged animationChanged = new net.runelite.api.events.AnimationChanged();" +
|
||||
"animationChanged.setActor((net.runelite.api.Actor)this);" +
|
||||
ByteCodePatcher.clientInstance + ".getCallbacks().post((java.lang.Object)animationChanged); }", ct);
|
||||
ct.addMethod(getAnimationChanged);
|
||||
}
|
||||
protectedAnimation.setName("getRsAnimation");
|
||||
ct.addMethod(protectedAnimation);
|
||||
|
||||
private void transformGraphicChanged() throws CannotCompileException, NotFoundException
|
||||
CtMethod getAnimation = ct.getDeclaredMethod("getAnimation");
|
||||
ct.removeMethod(getAnimation);
|
||||
|
||||
getAnimation = CtNewMethod.make(
|
||||
"public int getAnimation()" +
|
||||
"{" +
|
||||
" return this.getRsAnimation();" +
|
||||
"}", ct);
|
||||
ct.addMethod(getAnimation);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private void transformAnimationChanged() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod getAnimationChanged = ct.getDeclaredMethod("animationChanged", new CtClass[]{CtClass.intType});
|
||||
ct.removeMethod(getAnimationChanged);
|
||||
|
||||
getAnimationChanged = CtNewMethod.make(
|
||||
"public void animationChanged(int n)" +
|
||||
"{" +
|
||||
" net.runelite.api.events.AnimationChanged animationChanged = new net.runelite.api.events.AnimationChanged();" +
|
||||
" animationChanged.setActor((net.runelite.api.Actor) this);" +
|
||||
ByteCodePatcher.clientInstance + ".getCallbacks().post((java.lang.Object)animationChanged);" +
|
||||
"}", ct);
|
||||
ct.addMethod(getAnimationChanged);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformGraphicChanged() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod graphicChanged = ct.getDeclaredMethod("graphicChanged", new CtClass[]{CtClass.intType});
|
||||
ct.removeMethod(graphicChanged);
|
||||
|
||||
graphicChanged = CtNewMethod.make(
|
||||
"public void graphicChanged(int paramInt){" +
|
||||
"net.runelite.api.events.GraphicChanged localGraphicChanged = new net.runelite.api.events.GraphicChanged();" +
|
||||
"localGraphicChanged.setActor(this);" +
|
||||
ByteCodePatcher.clientInstance+".getCallbacks().post(localGraphicChanged);}",ct);
|
||||
"public void graphicChanged(int paramInt)" +
|
||||
"{" +
|
||||
" net.runelite.api.events.GraphicChanged localGraphicChanged = new net.runelite.api.events.GraphicChanged();" +
|
||||
" localGraphicChanged.setActor(this);" +
|
||||
ByteCodePatcher.clientInstance + ".getCallbacks().post(localGraphicChanged);" +
|
||||
"}", ct);
|
||||
ct.addMethod(graphicChanged);
|
||||
}
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,15 +8,20 @@ import javassist.NotFoundException;
|
||||
import javassist.bytecode.AnnotationsAttribute;
|
||||
import javassist.bytecode.ClassFile;
|
||||
import javassist.bytecode.ConstPool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
|
||||
public class ClientTransform implements Transform {
|
||||
@Slf4j
|
||||
public class ClientTransform implements Transform
|
||||
{
|
||||
|
||||
private CtClass ct;
|
||||
|
||||
@Override
|
||||
public void modify(Class clazz) {
|
||||
try {
|
||||
public void modify(Class clazz)
|
||||
{
|
||||
try
|
||||
{
|
||||
ct = ByteCodePatcher.classPool.get(clazz.getName());
|
||||
|
||||
transformProtectedGetMenuOptions();
|
||||
@@ -28,15 +33,17 @@ public class ClientTransform implements Transform {
|
||||
transformGetMenuEntries();
|
||||
transformSetMenuEntries();
|
||||
transformOnMenuOptionsChanged();
|
||||
transformGetProjectiles();
|
||||
transformGetCollisionMaps();
|
||||
transformDraw2010Menu();
|
||||
transformGetProjectiles();
|
||||
transformGetCollisionMaps();
|
||||
transformDraw2010Menu();
|
||||
transformRenderSelf();
|
||||
transformboundingBoxCheck();
|
||||
transformcheckClickBox();
|
||||
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -50,40 +57,53 @@ public class ClientTransform implements Transform {
|
||||
|
||||
protectedGetMenuOptions.setName("getMenuOptions");
|
||||
ct.addMethod(protectedGetMenuOptions);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformGetProjectiles() throws CannotCompileException, NotFoundException
|
||||
private void transformGetProjectiles() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod getProjectiles;
|
||||
CtMethod getProjectiles;
|
||||
|
||||
CtMethod getProjectilesDeque = ct.getDeclaredMethod("1protect$getProjectilesDeque");
|
||||
ct.removeMethod(getProjectilesDeque);
|
||||
CtMethod getProjectilesDeque = ct.getDeclaredMethod("1protect$getProjectilesDeque");
|
||||
ct.removeMethod(getProjectilesDeque);
|
||||
|
||||
getProjectilesDeque.setName("getProjectilesDeque");
|
||||
ct.addMethod(getProjectilesDeque);
|
||||
getProjectilesDeque.setName("getProjectilesDeque");
|
||||
ct.addMethod(getProjectilesDeque);
|
||||
|
||||
getProjectiles = ct.getDeclaredMethod("getProjectiles");
|
||||
ct.removeMethod(getProjectiles);
|
||||
getProjectiles = ct.getDeclaredMethod("getProjectiles");
|
||||
ct.removeMethod(getProjectiles);
|
||||
|
||||
getProjectiles = CtNewMethod.make(
|
||||
"public java.util.List getProjectiles() { " +
|
||||
"java.util.ArrayList localArrayList = new java.util.ArrayList();" +
|
||||
"net.runelite.rs.api.RSDeque localRSDeque = getProjectilesDeque();" +
|
||||
"net.runelite.rs.api.RSNode localRSNode = localRSDeque.getHead();" +
|
||||
"for (net.runelite.api.Node localNode = localRSNode.getNext(); localNode != localRSNode; localNode = localNode.getNext()) {" +
|
||||
"net.runelite.api.Projectile localProjectile = (net.runelite.api.Projectile)localNode;" +
|
||||
"localArrayList.add(localProjectile); }" +
|
||||
"return localArrayList; }", ct);
|
||||
ct.addMethod(getProjectiles);
|
||||
getProjectiles = CtNewMethod.make(
|
||||
"public java.util.List getProjectiles() { " +
|
||||
"java.util.ArrayList localArrayList = new java.util.ArrayList();" +
|
||||
"net.runelite.rs.api.RSDeque localRSDeque = getProjectilesDeque();" +
|
||||
"net.runelite.rs.api.RSNode localRSNode = localRSDeque.getHead();" +
|
||||
"for (net.runelite.api.Node localNode = localRSNode.getNext(); localNode != localRSNode; localNode = localNode.getNext()) {" +
|
||||
"net.runelite.api.Projectile localProjectile = (net.runelite.api.Projectile)localNode;" +
|
||||
"localArrayList.add(localProjectile); }" +
|
||||
"return localArrayList; }", ct);
|
||||
ct.addMethod(getProjectiles);
|
||||
|
||||
ClassFile classFile = ct.getClassFile();
|
||||
ConstPool constPool = classFile.getConstPool();
|
||||
AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
|
||||
javassist.bytecode.annotation.Annotation annotation = new javassist.bytecode.annotation.Annotation("Override", constPool);
|
||||
attr.setAnnotation(annotation);
|
||||
getProjectiles.getMethodInfo().addAttribute(attr);
|
||||
System.out.println("Added override annotation for getprojectiles");
|
||||
}
|
||||
ClassFile classFile = ct.getClassFile();
|
||||
ConstPool constPool = classFile.getConstPool();
|
||||
AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
|
||||
javassist.bytecode.annotation.Annotation annotation = new javassist.bytecode.annotation.Annotation("Override", constPool);
|
||||
attr.setAnnotation(annotation);
|
||||
getProjectiles.getMethodInfo().addAttribute(attr);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformProtectedGetMenuTargets() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
@@ -94,24 +114,38 @@ public class ClientTransform implements Transform {
|
||||
|
||||
protectedGetMenuTargets.setName("getMenuTargets");
|
||||
ct.addMethod(protectedGetMenuTargets);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformGetCollisionMaps() throws CannotCompileException, NotFoundException
|
||||
private void transformGetCollisionMaps() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod getCollisionMaps;
|
||||
CtMethod getCollisionMaps;
|
||||
|
||||
CtMethod protectedMaps = ct.getDeclaredMethod("1protect$getRsCollisionMaps");
|
||||
ct.removeMethod(protectedMaps);
|
||||
CtMethod protectedMaps = ct.getDeclaredMethod("1protect$getRsCollisionMaps");
|
||||
ct.removeMethod(protectedMaps);
|
||||
|
||||
protectedMaps.setName("getRsCollisionMaps");
|
||||
ct.addMethod(protectedMaps);
|
||||
protectedMaps.setName("getRsCollisionMaps");
|
||||
ct.addMethod(protectedMaps);
|
||||
|
||||
getCollisionMaps = ct.getDeclaredMethod("getCollisionMaps");
|
||||
ct.removeMethod(getCollisionMaps);
|
||||
getCollisionMaps = ct.getDeclaredMethod("getCollisionMaps");
|
||||
ct.removeMethod(getCollisionMaps);
|
||||
|
||||
getCollisionMaps = CtMethod.make("public net.runelite.rs.api.RSCollisionData[] getCollisionMaps() { return getRsCollisionMaps(); }", ct);
|
||||
ct.addMethod(getCollisionMaps);
|
||||
}
|
||||
getCollisionMaps = CtMethod.make("public net.runelite.rs.api.RSCollisionData[] getCollisionMaps() { return getRsCollisionMaps(); }", ct);
|
||||
ct.addMethod(getCollisionMaps);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformProtectedGetMenuIdentifiers() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
@@ -122,6 +156,13 @@ public class ClientTransform implements Transform {
|
||||
|
||||
protectedGetMenuIdentifiers.setName("getMenuIdentifiers");
|
||||
ct.addMethod(protectedGetMenuIdentifiers);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformProtectedGetMenuTypes() throws CannotCompileException, NotFoundException
|
||||
@@ -130,12 +171,19 @@ public class ClientTransform implements Transform {
|
||||
protectedGetMenuTypes = ct.getDeclaredMethod("1protect$getMenuTypes");
|
||||
|
||||
// Don't remove as this is referenced elsewhere in client
|
||||
//ct.removeMethod(protectedGetMenuTypes);
|
||||
// ct.removeMethod(protectedGetMenuTypes);
|
||||
|
||||
CtMethod newProtectedGetMenuTypes = CtNewMethod.copy(protectedGetMenuTypes, ct, null);
|
||||
newProtectedGetMenuTypes.setName("getMenuTypes");
|
||||
|
||||
ct.addMethod(newProtectedGetMenuTypes);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformProtectedGetMenuActionParams0() throws CannotCompileException, NotFoundException
|
||||
@@ -147,6 +195,13 @@ public class ClientTransform implements Transform {
|
||||
|
||||
protectedGetMenuActionParams0.setName("getMenuActionParams0");
|
||||
ct.addMethod(protectedGetMenuActionParams0);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformProtectedGetMenuActionParams1() throws CannotCompileException, NotFoundException
|
||||
@@ -157,6 +212,13 @@ public class ClientTransform implements Transform {
|
||||
ct.removeMethod(protectedGetMenuActionParams1);
|
||||
protectedGetMenuActionParams1.setName("getMenuActionParams1");
|
||||
ct.addMethod(protectedGetMenuActionParams1);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformGetMenuEntries() throws CannotCompileException, NotFoundException
|
||||
@@ -167,71 +229,86 @@ public class ClientTransform implements Transform {
|
||||
ct.removeMethod(getMenuEntries);
|
||||
|
||||
getMenuEntries = CtMethod.make(
|
||||
"public net.runelite.api.MenuEntry[] getMenuEntries() {" +
|
||||
"int n2 = this.getMenuOptionCount();"+
|
||||
"String[] arrstring = this.getMenuOptions();"+
|
||||
"String[] arrstring2 = this.getMenuTargets();"+
|
||||
"int[] arrn = this.getMenuIdentifiers();"+
|
||||
"int[] arrn2 = this.getMenuTypes();"+
|
||||
"int[] arrn3 = this.getMenuActionParams0();"+
|
||||
"int[] arrn4 = this.getMenuActionParams1();"+
|
||||
"boolean[] arrbl = this.getMenuForceLeftClick();"+
|
||||
"net.runelite.api.MenuEntry[] arrmenuEntry = new net.runelite.api.MenuEntry[n2];"+
|
||||
"int n3 = 0;"+
|
||||
"while (n3 < n2) {"+
|
||||
"net.runelite.api.MenuEntry menuEntry = arrmenuEntry[n3] = new net.runelite.api.MenuEntry();"+
|
||||
"menuEntry.setOption(arrstring[n3]);"+
|
||||
"menuEntry.setTarget(arrstring2[n3]);"+
|
||||
"menuEntry.setIdentifier(arrn[n3]);"+
|
||||
"menuEntry.setType(arrn2[n3]);"+
|
||||
"menuEntry.setParam0(arrn3[n3]);"+
|
||||
"menuEntry.setParam1(arrn4[n3]);"+
|
||||
"menuEntry.setForceLeftClick(arrbl[n3]);"+
|
||||
"++n3; }"+
|
||||
"return arrmenuEntry; }", ct);
|
||||
"public net.runelite.api.MenuEntry[] getMenuEntries()" +
|
||||
"{" +
|
||||
" int n2 = this.getMenuOptionCount();" +
|
||||
" String[] arrstring = this.getMenuOptions();" +
|
||||
" String[] arrstring2 = this.getMenuTargets();" +
|
||||
" int[] arrn = this.getMenuIdentifiers();" +
|
||||
" int[] arrn2 = this.getMenuTypes();" +
|
||||
" int[] arrn3 = this.getMenuActionParams0();" +
|
||||
" int[] arrn4 = this.getMenuActionParams1();" +
|
||||
" boolean[] arrbl = this.getMenuForceLeftClick();" +
|
||||
" net.runelite.api.MenuEntry[] arrmenuEntry = new net.runelite.api.MenuEntry[n2];" +
|
||||
" int n3 = 0;" +
|
||||
" while (n3 < n2) " +
|
||||
" {" +
|
||||
" net.runelite.api.MenuEntry menuEntry = arrmenuEntry[n3] = new net.runelite.api.MenuEntry();" +
|
||||
" menuEntry.setOption(arrstring[n3]);" +
|
||||
" menuEntry.setTarget(arrstring2[n3]);" +
|
||||
" menuEntry.setIdentifier(arrn[n3]);" +
|
||||
" menuEntry.setType(arrn2[n3]);" +
|
||||
" menuEntry.setParam0(arrn3[n3]);" +
|
||||
" menuEntry.setParam1(arrn4[n3]);" +
|
||||
" menuEntry.setForceLeftClick(arrbl[n3]);" +
|
||||
" ++n3;" +
|
||||
" }" +
|
||||
" return arrmenuEntry;" +
|
||||
"}", ct);
|
||||
ct.addMethod(getMenuEntries);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformSetMenuEntries() throws CannotCompileException, NotFoundException {
|
||||
private void transformSetMenuEntries() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod setMenuEntries;
|
||||
|
||||
setMenuEntries = ct.getDeclaredMethod("setMenuEntries");
|
||||
ct.removeMethod(setMenuEntries);
|
||||
setMenuEntries = CtNewMethod.make(
|
||||
"public void setMenuEntries(net.runelite.api.MenuEntry[] arrmenuEntry) {" +
|
||||
"int n2 = 0;" +
|
||||
"String[] arrstring = this.getMenuOptions();" +
|
||||
"String[] arrstring2 = this.getMenuTargets();" +
|
||||
"int[] arrn = this.getMenuIdentifiers();" +
|
||||
"int[] arrn2 = this.getMenuTypes();" +
|
||||
"int[] arrn3 = this.getMenuActionParams0();" +
|
||||
"int[] arrn4 = this.getMenuActionParams1();" +
|
||||
"boolean[] arrbl = getMenuForceLeftClick();" +
|
||||
"net.runelite.api.MenuEntry[] arrmenuEntry2 = arrmenuEntry;" +
|
||||
"int n3 = arrmenuEntry2.length;" +
|
||||
"int n4 = 0;" +
|
||||
"do {" +
|
||||
"String string;" +
|
||||
"if (n4 >= n3) {" +
|
||||
"this.setMenuOptionCount(n2);" +
|
||||
"oldMenuEntryCount = n2;" +
|
||||
"return;" +
|
||||
"}" +
|
||||
"net.runelite.api.MenuEntry menuEntry = arrmenuEntry2[n4];" +
|
||||
"int n5 = menuEntry.getType();" +
|
||||
"arrstring[n2] = menuEntry.getOption();" +
|
||||
"arrstring2[n2] = menuEntry.getTarget();" +
|
||||
"arrn[n2] = menuEntry.getIdentifier();" +
|
||||
"arrn2[n2] = n5;" +
|
||||
"arrn3[n2] = menuEntry.getParam0();" +
|
||||
"arrn4[n2] = menuEntry.getParam1();" +
|
||||
"arrbl[n2] = menuEntry.isForceLeftClick();" +
|
||||
"++n2;" +
|
||||
"++n4;" +
|
||||
"} while (true);" +
|
||||
"}"
|
||||
, ct);
|
||||
ct.addMethod(setMenuEntries);
|
||||
"public void setMenuEntries(net.runelite.api.MenuEntry[] arrmenuEntry)" +
|
||||
"{" +
|
||||
" int n2 = 0;" +
|
||||
" String[] arrstring = this.getMenuOptions();" +
|
||||
" String[] arrstring2 = this.getMenuTargets();" +
|
||||
" int[] arrn = this.getMenuIdentifiers();" +
|
||||
" int[] arrn2 = this.getMenuTypes();" +
|
||||
" int[] arrn3 = this.getMenuActionParams0();" +
|
||||
" int[] arrn4 = this.getMenuActionParams1();" +
|
||||
" boolean[] arrbl = getMenuForceLeftClick();" +
|
||||
" net.runelite.api.MenuEntry[] arrmenuEntry2 = arrmenuEntry;" +
|
||||
" int n3 = arrmenuEntry2.length;" +
|
||||
" int n4 = 0;" +
|
||||
" do" +
|
||||
" {" +
|
||||
" String string;" +
|
||||
" if (n4 >= n3)" +
|
||||
" {" +
|
||||
" this.setMenuOptionCount(n2);" +
|
||||
" oldMenuEntryCount = n2;" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" net.runelite.api.MenuEntry menuEntry = arrmenuEntry2[n4];" +
|
||||
" int n5 = menuEntry.getType();" +
|
||||
" arrstring[n2] = menuEntry.getOption();" +
|
||||
" arrstring2[n2] = menuEntry.getTarget();" +
|
||||
" arrn[n2] = menuEntry.getIdentifier();" +
|
||||
" arrn2[n2] = n5;" +
|
||||
" arrn3[n2] = menuEntry.getParam0();" +
|
||||
" arrn4[n2] = menuEntry.getParam1();" +
|
||||
" arrbl[n2] = menuEntry.isForceLeftClick();" +
|
||||
" ++n2;" +
|
||||
" ++n4;" +
|
||||
" } while (true);" +
|
||||
"}"
|
||||
, ct);
|
||||
ct.addMethod(setMenuEntries);
|
||||
}
|
||||
|
||||
private void transformOnMenuOptionsChanged() throws CannotCompileException, NotFoundException
|
||||
@@ -242,23 +319,31 @@ public class ClientTransform implements Transform {
|
||||
ct.removeMethod(onMenuOptionsChanged);
|
||||
|
||||
onMenuOptionsChanged = CtMethod.make(
|
||||
"public static void onMenuOptionsChanged(int n2) {"+
|
||||
"int n3;" +
|
||||
"int n4 = oldMenuEntryCount;"+
|
||||
"oldMenuEntryCount = n3 = "+ByteCodePatcher.clientInstance+".getMenuOptionCount();"+
|
||||
"if (n3 != n4 + 1) return;"+
|
||||
"net.runelite.api.events.MenuEntryAdded menuEntryAdded = new net.runelite.api.events.MenuEntryAdded("+
|
||||
ByteCodePatcher.clientInstance+".getMenuOptions()[n3 - 1],"+
|
||||
ByteCodePatcher.clientInstance+".getMenuTargets()[n3 - 1],"+
|
||||
ByteCodePatcher.clientInstance+".getMenuTypes()[n3 - 1],"+
|
||||
ByteCodePatcher.clientInstance+".getMenuIdentifiers()[n3 - 1],"+
|
||||
ByteCodePatcher.clientInstance+".getMenuActionParams0()[n3 - 1],"+
|
||||
ByteCodePatcher.clientInstance+".getMenuActionParams1()[n3 - 1]);"+
|
||||
ByteCodePatcher.clientInstance+".getCallbacks().post((Object)menuEntryAdded);"+
|
||||
"public static void onMenuOptionsChanged(int n2)" +
|
||||
"{" +
|
||||
" int n3;" +
|
||||
" int n4 = oldMenuEntryCount;" +
|
||||
" oldMenuEntryCount = n3 = " + ByteCodePatcher.clientInstance + ".getMenuOptionCount();" +
|
||||
" if (n3 != n4 + 1) return;" +
|
||||
" net.runelite.api.events.MenuEntryAdded menuEntryAdded = new net.runelite.api.events.MenuEntryAdded(" +
|
||||
ByteCodePatcher.clientInstance + ".getMenuOptions()[n3 - 1]," +
|
||||
ByteCodePatcher.clientInstance + ".getMenuTargets()[n3 - 1]," +
|
||||
ByteCodePatcher.clientInstance + ".getMenuTypes()[n3 - 1]," +
|
||||
ByteCodePatcher.clientInstance + ".getMenuIdentifiers()[n3 - 1]," +
|
||||
ByteCodePatcher.clientInstance + ".getMenuActionParams0()[n3 - 1]," +
|
||||
ByteCodePatcher.clientInstance + ".getMenuActionParams1()[n3 - 1]);" +
|
||||
ByteCodePatcher.clientInstance + ".getCallbacks().post((Object)menuEntryAdded);" +
|
||||
"}"
|
||||
, ct);
|
||||
|
||||
ct.addMethod(onMenuOptionsChanged);
|
||||
ct.addMethod(onMenuOptionsChanged);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformRenderSelf() throws CannotCompileException
|
||||
@@ -275,6 +360,13 @@ public class ClientTransform implements Transform {
|
||||
renderSelf.getMethodInfo().addAttribute(attr);
|
||||
|
||||
ct.addMethod(renderSelf);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformDraw2010Menu() throws CannotCompileException, NotFoundException
|
||||
@@ -285,51 +377,64 @@ public class ClientTransform implements Transform {
|
||||
ct.removeMethod(draw2010Menu);
|
||||
|
||||
draw2010Menu = CtNewMethod.make(
|
||||
"public void draw2010Menu() {" +
|
||||
"int n2 = this.getMenuX();" +
|
||||
"int n3 = this.getMenuY();" +
|
||||
"int n4 = this.getMenuWidth();" +
|
||||
"int n5 = this.getMenuHeight();" +
|
||||
"this.RasterizerDrawHorizontalLine(n2 + 2, n3, n4 - 4, 7170651);" +
|
||||
"this.RasterizerDrawHorizontalLine(n2 + 2, n3 + n5 - 1, n4 - 4, 7170651);" +
|
||||
"this.RasterizerDrawVerticalLine(n2, n3 + 2, n5 - 4, 7170651);" +
|
||||
"this.RasterizerDrawVerticalLine(n2 + n4 - 1, n3 + 2, n5 - 4, 7170651);" +
|
||||
"this.RasterizerDrawRectangle(n2 + 1, n3 + 5, n4 - 2, n5 - 6, 2827810);" +
|
||||
"this.RasterizerDrawHorizontalLine(n2 + 1, n3 + 17, n4 - 2, 2827810);" +
|
||||
"this.RasterizerDrawCircle(n2 + 2, n3 + n5 - 3, 0, 2827810);" +
|
||||
"this.RasterizerDrawCircle(n2 + n4 - 3, n3 + n5 - 3, 0, 2827810);" +
|
||||
"this.RasterizerDrawGradient(n2 + 2, n3 + 1, n4 - 4, 16, 3288610, 592388);" +
|
||||
"this.RasterizerFillRectangle(n2 + 1, n3 + 1, 2, 4, 2827810);" +
|
||||
"this.RasterizerFillRectangle(n2 + n4 - 3, n3 + 1, 2, 4, 2827810);" +
|
||||
"this.RasterizerDrawHorizontalLine(n2 + 2, n3 + 18, n4 - 4, 5392957);" +
|
||||
"this.RasterizerDrawHorizontalLine(n2 + 3, n3 + n5 - 3, n4 - 6, 5392957);" +
|
||||
"this.RasterizerDrawVerticalLine(n2 + 2, n3 + 18, n5 - 21, 5392957);" +
|
||||
"this.RasterizerDrawVerticalLine(n2 + n4 - 3, n3 + 18, n5 - 21, 5392957);" +
|
||||
"this.RasterizerFillRectangle(n2 + 3, n3 + 19, n4 - 6, n5 - 22, 2828060);" +
|
||||
"this.RasterizerDrawCircle(n2 + 1, n3 + 1, 0, 7170651);" +
|
||||
"this.RasterizerDrawCircle(n2 + n4 - 2, n3 + 1, 0, 7170651);" +
|
||||
"this.RasterizerDrawCircle(n2 + 1, n3 + n5 - 2, 0, 7170651);" +
|
||||
"this.RasterizerDrawCircle(n2 + n4 - 2, n3 + n5 - 2, 0, 7170651);" +
|
||||
"net.runelite.rs.api.RSFont rSFont = this.getFontBold12();" +
|
||||
"rSFont.drawTextLeftAligned(\"Choose Option\", n2 + 3, n3 + 14, 13023381, -1);" +
|
||||
"int n6 = this.getMouseX();" +
|
||||
"int n7 = this.getMouseY();" +
|
||||
"int n8 = this.getMenuOptionCount();" +
|
||||
"String[] arrstring = this.getMenuTargets();" +
|
||||
"String[] arrstring2 = this.getMenuOptions();" +
|
||||
"for (int i = 0; i < n8; ++i) {" +
|
||||
"int n9 = n3 + (n8 - 1 - i) * 15 + 31;" +
|
||||
"String string = arrstring2[i];" +
|
||||
"if (!arrstring[i].isEmpty()) {" +
|
||||
"string = string + \" \" + arrstring[i];" +
|
||||
"}" +
|
||||
"rSFont.drawTextLeftAligned(string, n2 + 3, n9, 13023381, -1);" +
|
||||
"if (n6 <= n2 || n6 >= n4 + n2 || n7 <= n9 - 13 || n7 >= n9 + 3) continue;" +
|
||||
"this.RasterizerFillRectangleAlpha(n2 + 3, n9 - 12, n4 - 6, 15, 16777215, 80);" +
|
||||
"}" +
|
||||
"public void draw2010Menu()" +
|
||||
"{" +
|
||||
" int n2 = this.getMenuX();" +
|
||||
" int n3 = this.getMenuY();" +
|
||||
" int n4 = this.getMenuWidth();" +
|
||||
" int n5 = this.getMenuHeight();" +
|
||||
" this.RasterizerDrawHorizontalLine(n2 + 2, n3, n4 - 4, 7170651);" +
|
||||
" this.RasterizerDrawHorizontalLine(n2 + 2, n3 + n5 - 1, n4 - 4, 7170651);" +
|
||||
" this.RasterizerDrawVerticalLine(n2, n3 + 2, n5 - 4, 7170651);" +
|
||||
" this.RasterizerDrawVerticalLine(n2 + n4 - 1, n3 + 2, n5 - 4, 7170651);" +
|
||||
" this.RasterizerDrawRectangle(n2 + 1, n3 + 5, n4 - 2, n5 - 6, 2827810);" +
|
||||
" this.RasterizerDrawHorizontalLine(n2 + 1, n3 + 17, n4 - 2, 2827810);" +
|
||||
" this.RasterizerDrawCircle(n2 + 2, n3 + n5 - 3, 0, 2827810);" +
|
||||
" this.RasterizerDrawCircle(n2 + n4 - 3, n3 + n5 - 3, 0, 2827810);" +
|
||||
" this.RasterizerDrawGradient(n2 + 2, n3 + 1, n4 - 4, 16, 3288610, 592388);" +
|
||||
" this.RasterizerFillRectangle(n2 + 1, n3 + 1, 2, 4, 2827810);" +
|
||||
" this.RasterizerFillRectangle(n2 + n4 - 3, n3 + 1, 2, 4, 2827810);" +
|
||||
" this.RasterizerDrawHorizontalLine(n2 + 2, n3 + 18, n4 - 4, 5392957);" +
|
||||
" this.RasterizerDrawHorizontalLine(n2 + 3, n3 + n5 - 3, n4 - 6, 5392957);" +
|
||||
" this.RasterizerDrawVerticalLine(n2 + 2, n3 + 18, n5 - 21, 5392957);" +
|
||||
" this.RasterizerDrawVerticalLine(n2 + n4 - 3, n3 + 18, n5 - 21, 5392957);" +
|
||||
" this.RasterizerFillRectangle(n2 + 3, n3 + 19, n4 - 6, n5 - 22, 2828060);" +
|
||||
" this.RasterizerDrawCircle(n2 + 1, n3 + 1, 0, 7170651);" +
|
||||
" this.RasterizerDrawCircle(n2 + n4 - 2, n3 + 1, 0, 7170651);" +
|
||||
" this.RasterizerDrawCircle(n2 + 1, n3 + n5 - 2, 0, 7170651);" +
|
||||
" this.RasterizerDrawCircle(n2 + n4 - 2, n3 + n5 - 2, 0, 7170651);" +
|
||||
" net.runelite.rs.api.RSFont rSFont = this.getFontBold12();" +
|
||||
" rSFont.drawTextLeftAligned(\"Choose Option\", n2 + 3, n3 + 14, 13023381, -1);" +
|
||||
" int n6 = this.getMouseX();" +
|
||||
" int n7 = this.getMouseY();" +
|
||||
" int n8 = this.getMenuOptionCount();" +
|
||||
" String[] arrstring = this.getMenuTargets();" +
|
||||
" String[] arrstring2 = this.getMenuOptions();" +
|
||||
" for (int i = 0; i < n8; ++i)" +
|
||||
" {" +
|
||||
" int n9 = n3 + (n8 - 1 - i) * 15 + 31;" +
|
||||
" String string = arrstring2[i];" +
|
||||
" if (!arrstring[i].isEmpty())" +
|
||||
" {" +
|
||||
" string = string + \" \" + arrstring[i];" +
|
||||
" }" +
|
||||
" rSFont.drawTextLeftAligned(string, n2 + 3, n9, 13023381, -1);" +
|
||||
" if (n6 <= n2 || n6 >= n4 + n2 || n7 <= n9 - 13 || n7 >= n9 + 3)" +
|
||||
" {" +
|
||||
" continue;" +
|
||||
" }" +
|
||||
" this.RasterizerFillRectangleAlpha(n2 + 3, n9 - 12, n4 - 6, 15, 16777215, 80);" +
|
||||
" }" +
|
||||
"}"
|
||||
, ct);
|
||||
ct.addMethod(draw2010Menu);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
//TODO: fix not being able to click far away objects towards top of screen only.
|
||||
@@ -338,70 +443,86 @@ public class ClientTransform implements Transform {
|
||||
CtMethod boundingboxCheck2;
|
||||
|
||||
boundingboxCheck2 = CtMethod.make(
|
||||
"public boolean boundingboxCheck2(net.runelite.api.Model model, int n2, int n3, int n4) {" +
|
||||
"int n5 = "+ByteCodePatcher.clientInstance+".getCameraPitch();" +
|
||||
"int n6 = "+ByteCodePatcher.clientInstance+".getCameraYaw();" +
|
||||
"int n7 = net.runelite.api.Perspective.SINE[n5];" +
|
||||
"int n8 = net.runelite.api.Perspective.COSINE[n5];" +
|
||||
"int n9 = net.runelite.api.Perspective.SINE[n6];" +
|
||||
"int n10 = net.runelite.api.Perspective.COSINE[n6];" +
|
||||
"int n11 = "+ByteCodePatcher.clientInstance+".getCenterX();" +
|
||||
"int n12 = "+ByteCodePatcher.clientInstance+".getCenterY();" +
|
||||
"int n13 = "+ByteCodePatcher.clientInstance+".getViewportMouseX();" +
|
||||
"int n14 = "+ByteCodePatcher.clientInstance+".getViewportMouseY();" +
|
||||
"int n15 = "+ByteCodePatcher.clientInstance+".get3dZoom();" +
|
||||
"int n16 = (n13 - n11) * 50 / n15;" +
|
||||
"int n17 = (n14 - n12) * 50 / n15;" +
|
||||
"int n18 = (n13 - n11) * 10000 / n15;" +
|
||||
"int n19 = (n14 - n12) * 10000 / n15;" +
|
||||
"int n20 = client.rl$rot1(n17, 50, n8, n7);" +
|
||||
"int n21 = client.rl$rot2(n17, 50, n8, n7);" +
|
||||
"n17 = n20;" +
|
||||
"n20 = client.rl$rot1(n19, 10000, n8, n7);" +
|
||||
"int n22 = client.rl$rot2(n19, 10000, n8, n7);" +
|
||||
"n19 = n20;" +
|
||||
"n20 = client.rl$rot3(n16, n21, n10, n9);" +
|
||||
"n21 = client.rl$rot4(n16, n21, n10, n9);" +
|
||||
"n16 = n20;" +
|
||||
"n20 = client.rl$rot3(n18, n22, n10, n9);" +
|
||||
"n22 = client.rl$rot4(n18, n22, n10, n9);" +
|
||||
"int n23 = (n20 - n16) / 2;" +
|
||||
"int n24 = (n19 - n17) / 2;" +
|
||||
"int n25 = (n22 - n21) / 2;" +
|
||||
"int n26 = Math.abs(n23);" +
|
||||
"int n27 = Math.abs(n24);" +
|
||||
"int n28 = Math.abs(n25);" +
|
||||
"int n29 = n2 + model.getCenterX();" +
|
||||
"int n30 = n3 + model.getCenterY();" +
|
||||
"int n31 = n4 + model.getCenterZ();" +
|
||||
"int n32 = model.getExtremeX();" +
|
||||
"int n33 = model.getExtremeY();" +
|
||||
"int n34 = model.getExtremeZ();" +
|
||||
"int n35 = (n16 + n20) / 2;" +
|
||||
"int n36 = (n17 + n19) / 2;" +
|
||||
"int n37 = (n22 + n21) / 2;" +
|
||||
"int n38 = n35 - n29;" +
|
||||
"int n39 = n36 - n30;" +
|
||||
"int n40 = n37 - n31;" +
|
||||
"if (Math.abs(n38) > n32 + n26) {" +
|
||||
"return false;" +
|
||||
"}" +
|
||||
"if (Math.abs(n39) > n33 + n27) {" +
|
||||
"return false;" +
|
||||
"}" +
|
||||
"if (Math.abs(n40) > n34 + n28) {" +
|
||||
"return false;" +
|
||||
"}" +
|
||||
"if (Math.abs(n40 * n24 - n39 * n25) > n33 * n28 + n34 * n27) {" +
|
||||
"return false;" +
|
||||
"}" +
|
||||
"if (Math.abs(n38 * n25 - n40 * n23) > n34 * n26 + n32 * n28) {" +
|
||||
"return false;" +
|
||||
"}" +
|
||||
"if (Math.abs(n39 * n23 - n38 * n24) <= n33 * n26 + n32 * n27) return true;" +
|
||||
"return false;" +
|
||||
"}", ct);
|
||||
"public boolean boundingboxCheck2(net.runelite.api.Model model, int n2, int n3, int n4)" +
|
||||
"{" +
|
||||
" int n5 = " + ByteCodePatcher.clientInstance + ".getCameraPitch();" +
|
||||
" int n6 = " + ByteCodePatcher.clientInstance + ".getCameraYaw();" +
|
||||
" int n7 = net.runelite.api.Perspective.SINE[n5];" +
|
||||
" int n8 = net.runelite.api.Perspective.COSINE[n5];" +
|
||||
" int n9 = net.runelite.api.Perspective.SINE[n6];" +
|
||||
" int n10 = net.runelite.api.Perspective.COSINE[n6];" +
|
||||
" int n11 = " + ByteCodePatcher.clientInstance + ".getCenterX();" +
|
||||
" int n12 = " + ByteCodePatcher.clientInstance + ".getCenterY();" +
|
||||
" int n13 = " + ByteCodePatcher.clientInstance + ".getViewportMouseX();" +
|
||||
" int n14 = " + ByteCodePatcher.clientInstance + ".getViewportMouseY();" +
|
||||
" int n15 = " + ByteCodePatcher.clientInstance + ".get3dZoom();" +
|
||||
" int n16 = (n13 - n11) * 50 / n15;" +
|
||||
" int n17 = (n14 - n12) * 50 / n15;" +
|
||||
" int n18 = (n13 - n11) * 10000 / n15;" +
|
||||
" int n19 = (n14 - n12) * 10000 / n15;" +
|
||||
" int n20 = client.rl$rot1(n17, 50, n8, n7);" +
|
||||
" int n21 = client.rl$rot2(n17, 50, n8, n7);" +
|
||||
" n17 = n20;" +
|
||||
" n20 = client.rl$rot1(n19, 10000, n8, n7);" +
|
||||
" int n22 = client.rl$rot2(n19, 10000, n8, n7);" +
|
||||
" n19 = n20;" +
|
||||
" n20 = client.rl$rot3(n16, n21, n10, n9);" +
|
||||
" n21 = client.rl$rot4(n16, n21, n10, n9);" +
|
||||
" n16 = n20;" +
|
||||
" n20 = client.rl$rot3(n18, n22, n10, n9);" +
|
||||
" n22 = client.rl$rot4(n18, n22, n10, n9);" +
|
||||
" int n23 = (n20 - n16) / 2;" +
|
||||
" int n24 = (n19 - n17) / 2;" +
|
||||
" int n25 = (n22 - n21) / 2;" +
|
||||
" int n26 = Math.abs(n23);" +
|
||||
" int n27 = Math.abs(n24);" +
|
||||
" int n28 = Math.abs(n25);" +
|
||||
" int n29 = n2 + model.getCenterX();" +
|
||||
" int n30 = n3 + model.getCenterY();" +
|
||||
" int n31 = n4 + model.getCenterZ();" +
|
||||
" int n32 = model.getExtremeX();" +
|
||||
" int n33 = model.getExtremeY();" +
|
||||
" int n34 = model.getExtremeZ();" +
|
||||
" int n35 = (n16 + n20) / 2;" +
|
||||
" int n36 = (n17 + n19) / 2;" +
|
||||
" int n37 = (n22 + n21) / 2;" +
|
||||
" int n38 = n35 - n29;" +
|
||||
" int n39 = n36 - n30;" +
|
||||
" int n40 = n37 - n31;" +
|
||||
" if (Math.abs(n38) > n32 + n26)" +
|
||||
" {" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if (Math.abs(n39) > n33 + n27)" +
|
||||
" {" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if (Math.abs(n40) > n34 + n28)" +
|
||||
" {" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if (Math.abs(n40 * n24 - n39 * n25) > n33 * n28 + n34 * n27)" +
|
||||
" {" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if (Math.abs(n38 * n25 - n40 * n23) > n34 * n26 + n32 * n28)" +
|
||||
" {" +
|
||||
" return false;" +
|
||||
" }" +
|
||||
" if (Math.abs(n39 * n23 - n38 * n24) <= n33 * n26 + n32 * n27)" +
|
||||
" {" +
|
||||
" return true;" +
|
||||
" }" +
|
||||
" return false;" +
|
||||
"}", ct);
|
||||
ct.addMethod(boundingboxCheck2);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
|
||||
private void transformcheckClickBox() throws CannotCompileException, NotFoundException
|
||||
@@ -412,88 +533,110 @@ public class ClientTransform implements Transform {
|
||||
ct.removeMethod(checkClickBox);
|
||||
|
||||
checkClickBox = CtMethod.make(
|
||||
"public void checkClickbox(net.runelite.api.Model model, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, long l2) {"+
|
||||
"int n10;" +
|
||||
"int n11;" +
|
||||
"int n12;" +
|
||||
"int n13;" +
|
||||
"int n14;" +
|
||||
"net.runelite.rs.api.RSModel rSModel = (net.runelite.rs.api.RSModel)model;" +
|
||||
"boolean bl2 = l2 != 0L && (int)(l2 >>> 16 & 1L) != 1;" +
|
||||
"boolean bl3 = "+ByteCodePatcher.clientInstance+".getViewportContainsMouse();" +
|
||||
"if (!bl2) return;" +
|
||||
"if (!bl3) return;" +
|
||||
"boolean bl4 = this.boundingboxCheck2((net.runelite.api.Model)rSModel, n7, n8, n9);" +
|
||||
"if (!bl4) {" +
|
||||
"return;" +
|
||||
"}" +
|
||||
"if (rSModel.isClickable()) {" +
|
||||
"this.addHashAtMouse(l2);" +
|
||||
"return;" +
|
||||
"}" +
|
||||
"int n15 = rSModel.getVerticesCount();" +
|
||||
"int n16 = rSModel.getTrianglesCount();" +
|
||||
"int[] arrn = rSModel.getVerticesX();" +
|
||||
"int[] arrn2 = rSModel.getVerticesY();" +
|
||||
"int[] arrn3 = rSModel.getVerticesZ();" +
|
||||
"int[] arrn4 = rSModel.getTrianglesX();" +
|
||||
"int[] arrn5 = rSModel.getTrianglesY();" +
|
||||
"int[] arrn6 = rSModel.getTrianglesZ();" +
|
||||
"int[] arrn7 = rSModel.getFaceColors3();" +
|
||||
"int n17 = "+ByteCodePatcher.clientInstance+".get3dZoom();" +
|
||||
"int n18 = "+ByteCodePatcher.clientInstance+".getCenterX();" +
|
||||
"int n19 = "+ByteCodePatcher.clientInstance+".getCenterY();" +
|
||||
"int n20 = 0;" +
|
||||
"int n21 = 0;" +
|
||||
"if (n2 != 0) {" +
|
||||
"n20 = net.runelite.api.Perspective.SINE[n2];" +
|
||||
"n21 = net.runelite.api.Perspective.COSINE[n2];" +
|
||||
"}" +
|
||||
"for (n14 = 0; n14 < n15; ++n14) {" +
|
||||
"n11 = arrn[n14];" +
|
||||
"n13 = arrn2[n14];" +
|
||||
"n12 = arrn3[n14];" +
|
||||
"if (n2 != 0) {" +
|
||||
"n10 = n12 * n20 + n11 * n21 >> 16;" +
|
||||
"n12 = n12 * n21 - n11 * n20 >> 16;" +
|
||||
"n11 = n10;" +
|
||||
"}" +
|
||||
"n10 = (n12 += n9) * n5 + n6 * (n11 += n7) >> 16;" +
|
||||
"n12 = n6 * n12 - n11 * n5 >> 16;" +
|
||||
"n11 = n10;" +
|
||||
"n10 = n4 * (n13 += n8) - n12 * n3 >> 16;" +
|
||||
"if ((n12 = n13 * n3 + n4 * n12 >> 16) >= 50) {" +
|
||||
"client.rl$modelViewportYs[n14] = n11 * n17 / n12 + n18;" +
|
||||
"client.rl$modelViewportXs[n14] = n10 * n17 / n12 + n19;" +
|
||||
"continue;" +
|
||||
"}" +
|
||||
"client.rl$modelViewportYs[n14] = -5000;" +
|
||||
"}" +
|
||||
"n14 = "+ByteCodePatcher.clientInstance+".getViewportMouseX();" +
|
||||
"n11 = "+ByteCodePatcher.clientInstance+".getViewportMouseY();" +
|
||||
"n13 = 0;" +
|
||||
"while (n13 < n16) {" +
|
||||
"if (arrn7[n13] != -2) {" +
|
||||
"int n22;" +
|
||||
"boolean bl5;" +
|
||||
"int n23;" +
|
||||
"n12 = arrn4[n13];" +
|
||||
"n10 = arrn5[n13];" +
|
||||
"int n24 = arrn6[n13];" +
|
||||
"int n25 = rl$modelViewportYs[n12];" +
|
||||
"int n26 = rl$modelViewportYs[n10];" +
|
||||
"int n27 = rl$modelViewportYs[n24];" +
|
||||
"int n28 = rl$modelViewportXs[n12];" +
|
||||
"int n29 = rl$modelViewportXs[n10];" +
|
||||
"int n30 = rl$modelViewportXs[n24];" +
|
||||
"if (n25 != -5000 && n26 != -5000 && n27 != -5000 && (bl5 = (n23 = (n22 = rSModel.isClickable() ? 20 : 5) + n11) < n28 && n23 < n29 && n23 < n30 ? false : ((n23 = n11 - n22) > n28 && n23 > n29 && n23 > n30 ? false : ((n23 = n22 + n14) < n25 && n23 < n26 && n23 < n27 ? false : (n23 = n14 - n22) <= n25 || n23 <= n26 || n23 <= n27)))) {" +
|
||||
"this.addHashAtMouse(l2);" +
|
||||
"return;" +
|
||||
"}" +
|
||||
"}" +
|
||||
"++n13;" +
|
||||
"}" +
|
||||
"}", ct);
|
||||
ct.addMethod(checkClickBox);
|
||||
"public void checkClickbox(net.runelite.api.Model model, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, long l2) {" +
|
||||
" int n10;" +
|
||||
" int n11;" +
|
||||
" int n12;" +
|
||||
" int n13;" +
|
||||
" int n14;" +
|
||||
" net.runelite.rs.api.RSModel rSModel = (net.runelite.rs.api.RSModel)model;" +
|
||||
" boolean bl2 = l2 != 0L && (int)(l2 >>> 16 & 1L) != 1;" +
|
||||
" boolean bl3 = " + ByteCodePatcher.clientInstance + ".getViewportContainsMouse();" +
|
||||
" if (!bl2)" +
|
||||
" {" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" if (!bl3)" +
|
||||
" {" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" boolean bl4 = this.boundingboxCheck2((net.runelite.api.Model)rSModel, n7, n8, n9);" +
|
||||
" if (!bl4)" +
|
||||
" {" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" if (rSModel.isClickable())" +
|
||||
" {" +
|
||||
" this.addHashAtMouse(l2);" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" int n15 = rSModel.getVerticesCount();" +
|
||||
" int n16 = rSModel.getTrianglesCount();" +
|
||||
" int[] arrn = rSModel.getVerticesX();" +
|
||||
" int[] arrn2 = rSModel.getVerticesY();" +
|
||||
" int[] arrn3 = rSModel.getVerticesZ();" +
|
||||
" int[] arrn4 = rSModel.getTrianglesX();" +
|
||||
" int[] arrn5 = rSModel.getTrianglesY();" +
|
||||
" int[] arrn6 = rSModel.getTrianglesZ();" +
|
||||
" int[] arrn7 = rSModel.getFaceColors3();" +
|
||||
" int n17 = " + ByteCodePatcher.clientInstance + ".get3dZoom();" +
|
||||
" int n18 = " + ByteCodePatcher.clientInstance + ".getCenterX();" +
|
||||
" int n19 = " + ByteCodePatcher.clientInstance + ".getCenterY();" +
|
||||
" int n20 = 0;" +
|
||||
" int n21 = 0;" +
|
||||
" if (n2 != 0)" +
|
||||
" {" +
|
||||
" n20 = net.runelite.api.Perspective.SINE[n2];" +
|
||||
" n21 = net.runelite.api.Perspective.COSINE[n2];" +
|
||||
" }" +
|
||||
" for (n14 = 0; n14 < n15; ++n14)" +
|
||||
" {" +
|
||||
" n11 = arrn[n14];" +
|
||||
" n13 = arrn2[n14];" +
|
||||
" n12 = arrn3[n14];" +
|
||||
" if (n2 != 0)" +
|
||||
" {" +
|
||||
" n10 = n12 * n20 + n11 * n21 >> 16;" +
|
||||
" n12 = n12 * n21 - n11 * n20 >> 16;" +
|
||||
" n11 = n10;" +
|
||||
" }" +
|
||||
" n10 = (n12 += n9) * n5 + n6 * (n11 += n7) >> 16;" +
|
||||
" n12 = n6 * n12 - n11 * n5 >> 16;" +
|
||||
" n11 = n10;" +
|
||||
" n10 = n4 * (n13 += n8) - n12 * n3 >> 16;" +
|
||||
" if ((n12 = n13 * n3 + n4 * n12 >> 16) >= 50)" +
|
||||
" {" +
|
||||
" client.rl$modelViewportYs[n14] = n11 * n17 / n12 + n18;" +
|
||||
" client.rl$modelViewportXs[n14] = n10 * n17 / n12 + n19;" +
|
||||
" continue;" +
|
||||
" }" +
|
||||
" client.rl$modelViewportYs[n14] = -5000;" +
|
||||
" }" +
|
||||
" n14 = " + ByteCodePatcher.clientInstance + ".getViewportMouseX();" +
|
||||
" n11 = " + ByteCodePatcher.clientInstance + ".getViewportMouseY();" +
|
||||
" n13 = 0;" +
|
||||
" while (n13 < n16)" +
|
||||
" {" +
|
||||
" if (arrn7[n13] != -2)" +
|
||||
" {" +
|
||||
" int n22;" +
|
||||
" boolean bl5;" +
|
||||
" int n23;" +
|
||||
" n12 = arrn4[n13];" +
|
||||
" n10 = arrn5[n13];" +
|
||||
" int n24 = arrn6[n13];" +
|
||||
" int n25 = rl$modelViewportYs[n12];" +
|
||||
" int n26 = rl$modelViewportYs[n10];" +
|
||||
" int n27 = rl$modelViewportYs[n24];" +
|
||||
" int n28 = rl$modelViewportXs[n12];" +
|
||||
" int n29 = rl$modelViewportXs[n10];" +
|
||||
" int n30 = rl$modelViewportXs[n24];" +
|
||||
" if (n25 != -5000 && n26 != -5000 && n27 != -5000 && (bl5 = (n23 = (n22 = rSModel.isClickable() ? 20 : 5) + n11) < n28 && n23 < n29 && n23 < n30 ? false : ((n23 = n11 - n22) > n28 && n23 > n29 && n23 > n30 ? false : ((n23 = n22 + n14) < n25 && n23 < n26 && n23 < n27 ? false : (n23 = n14 - n22) <= n25 || n23 <= n26 || n23 <= n27))))" +
|
||||
" {" +
|
||||
" this.addHashAtMouse(l2);" +
|
||||
" return;" +
|
||||
" }" +
|
||||
" }" +
|
||||
" ++n13;" +
|
||||
" }" +
|
||||
"}", ct);
|
||||
ct.addMethod(checkClickBox);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,40 +4,54 @@ import javassist.CannotCompileException;
|
||||
import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
import javassist.NotFoundException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.rs.bytecode.ByteCodePatcher;
|
||||
|
||||
//This prevents the client from sending stack traces to Jagex at all, even classes outside of runelite.
|
||||
public class ErrorTransform implements Transform {
|
||||
@Slf4j
|
||||
// This prevents the client from sending stack traces to Jagex at all, even classes outside of runelite.
|
||||
public class ErrorTransform implements Transform
|
||||
{
|
||||
private CtClass ct;
|
||||
|
||||
//Where Runelites error interceptor is located, not auto-scraped.
|
||||
private static final String ERROR_INSTANCE_CLASS = "dp";
|
||||
private static final String ERROR_INSTANCE_METHOD = "a";
|
||||
//private static final String ERROR_WARNING = "Tried to send a warning";
|
||||
|
||||
@Override
|
||||
public void modify(Class clazz) {
|
||||
try {
|
||||
System.out.println("[RuneLitePlus] Transforming error method at class: "+ERROR_INSTANCE_CLASS);
|
||||
// Where Runelites error interceptor is located, not auto-scraped.
|
||||
private static final String ERROR_INSTANCE_CLASS = "dp";
|
||||
private static final String ERROR_INSTANCE_METHOD = "a";
|
||||
// private static final String ERROR_WARNING = "Tried to send a warning";
|
||||
|
||||
@Override
|
||||
public void modify(Class clazz)
|
||||
{
|
||||
try
|
||||
{
|
||||
ct = ByteCodePatcher.classPool.get(ERROR_INSTANCE_CLASS);
|
||||
transformError();
|
||||
transformError();
|
||||
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
} catch (CannotCompileException | NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ByteCodePatcher.modifiedClasses.add(ct);
|
||||
}
|
||||
catch (CannotCompileException | NotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void transformError() throws CannotCompileException, NotFoundException
|
||||
private void transformError() throws CannotCompileException, NotFoundException
|
||||
{
|
||||
CtMethod error = ct.getDeclaredMethod(ERROR_INSTANCE_METHOD);
|
||||
ct.removeMethod(error);
|
||||
|
||||
error = CtMethod.make(
|
||||
"public static void a(String string, Throwable throwable, byte by) {"+
|
||||
"throwable.printStackTrace();"+
|
||||
"System.out.println(\"[RuneLitePlus] Prevented preceeding stack trace from being sent to Jagex\");}", ct);
|
||||
"public static void a(String string, Throwable throwable, byte by)" +
|
||||
"{" +
|
||||
" throwable.printStackTrace();" +
|
||||
" System.out.println(\"[RuneLitePlus] Prevented preceeding stack trace from being sent to Jagex\");" +
|
||||
"}", ct);
|
||||
ct.addMethod(error);
|
||||
|
||||
log.info(
|
||||
"[RuneLitePlus] transformed {} ({}) at class: {}",
|
||||
this.getClass().getSimpleName(),
|
||||
new Object(){}.getClass().getEnclosingMethod().getName(),
|
||||
ct.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user