Merge pull request #256 from sdburns1998/Cleanup

Cleanup
This commit is contained in:
Tyler Bochard
2019-05-15 22:39:36 -04:00
committed by GitHub
102 changed files with 5261 additions and 4477 deletions

View File

@@ -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();
}

View File

@@ -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;
}

View File

@@ -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,7 +236,7 @@ public interface AoeWarningConfig extends Config
keyName = "addyDrags",
name = "Addy Drags",
description = "Show Bad Areas",
position = 4
position = 18
)
default boolean addyDrags()
{
@@ -254,9 +244,9 @@ public interface AoeWarningConfig extends Config
}
@ConfigItem(
keyName = "drake",
name = "Drakes Breath",
description = "Configures if Drakes Breath tile markers are displayed"
keyName = "drake", name = "Drakes Breath",
description = "Configures if Drakes Breath tile markers are displayed",
position = 19
)
default boolean isDrakeEnabled()
{
@@ -266,7 +256,8 @@ public interface AoeWarningConfig extends Config
@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()
{

View File

@@ -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);

View File

@@ -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.

View File

@@ -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

View File

@@ -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();
}

View File

@@ -38,7 +38,10 @@ 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",
@@ -46,7 +49,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Displays wave and game duration",
position = 1
)
default boolean waveTimes() { return true; }
default boolean waveTimes()
{
return true;
}
@ConfigItem(
keyName = "showEggCountMessage",
@@ -54,7 +60,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Display egg count as collector after each wave",
position = 2
)
default boolean showEggCount() { return false; }
default boolean showEggCount()
{
return false;
}
@ConfigItem(
keyName = "showEggCountOverlay",
@@ -62,7 +71,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Display current egg count as collector",
position = 3
)
default boolean showEggCountOverlay() { return false; }
default boolean showEggCountOverlay()
{
return false;
}
@ConfigItem(
keyName = "showHpCountMessage",
@@ -70,7 +82,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Display healed count as healer after each wave",
position = 4
)
default boolean showHpCount() { return false; }
default boolean showHpCount()
{
return false;
}
@ConfigItem(
keyName = "showHpCountOverlay",
@@ -78,7 +93,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Display current healed count as healer",
position = 5
)
default boolean showHpCountOverlay() { return false; }
default boolean showHpCountOverlay()
{
return false;
}
@ConfigItem(
keyName = "highlightCollectorEggs",
@@ -86,7 +104,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Highlight called egg colors",
position = 6
)
default boolean highlightCollectorEggs() { return false; }
default boolean highlightCollectorEggs()
{
return false;
}
@ConfigItem(
keyName = "showTotalRewards",
@@ -94,7 +115,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Displays total eggs/healed hp and missed attacks/lost runners",
position = 7
)
default boolean showTotalRewards(){ return false; };
default boolean showTotalRewards()
{
return false;
}
@ConfigItem(
keyName = "showSummaryOfPoints",
@@ -102,7 +126,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Gives summary of advanced points breakdown in chat log",
position = 8
)
default boolean showSummaryOfPoints() { return false; };
default boolean showSummaryOfPoints()
{
return false;
}
@ConfigItem(
keyName = "wrongPoisonFoodTextColor",
@@ -110,7 +137,10 @@ public interface BarbarianAssaultConfig extends Config
description = "Change healer wrong poison pack color",
position = 9
)
default Color wrongPoisonFoodTextColor() { return Color.BLACK;}
default Color wrongPoisonFoodTextColor()
{
return Color.BLACK;
}
@ConfigItem(
keyName = "highlightItems",

View File

@@ -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;
@@ -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));

View File

@@ -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,7 +75,6 @@ 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
@@ -86,14 +93,19 @@ 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;
@@ -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,39 +144,14 @@ 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
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(BarbarianAssaultConfig.class);
}
private Game game;
private Wave wave;
@Override
protected void startUp() throws Exception
{
@@ -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());
@@ -255,7 +243,9 @@ public class BarbarianAssaultPlugin extends Plugin
}
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,6 +358,7 @@ public class BarbarianAssaultPlugin extends Plugin
inGameBit = inGame;
}
@Subscribe
public void onItemSpawned(ItemSpawned itemSpawned)
{
@@ -584,12 +575,8 @@ public class BarbarianAssaultPlugin extends Plugin
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);

View File

@@ -24,16 +24,14 @@
*/
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
{
@@ -61,11 +59,13 @@ public class Game
{
this.client = client;
}
Game(Client client, ArrayList<Wave> waves)
{
this.client = client;
this.waves = waves;
}
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
@@ -82,6 +82,7 @@ public class Game
totalAmounts = new int[6];
}
}
ChatMessageBuilder getGameSummary()
{
int[] amountsList;
@@ -94,13 +95,16 @@ public class Game
amountsList = w.getWaveAmounts();
pointsList = w.getWavePoints();
otherRolesPointsList = w.getOtherRolesPointsList();
for (int j = 0; j < totalAmounts.length; j++) {
for (int j = 0; j < totalAmounts.length; j++)
{
totalAmounts[j] += amountsList[j];
}
for (int k = 0; k < totalPoints.length; k++) {
for (int k = 0; k < totalPoints.length; k++)
{
totalPoints[k] += pointsList[k];
}
for (int z = 0; z < otherRolesPoints.length; z++) {
for (int z = 0; z < otherRolesPoints.length; z++)
{
otherRolesPoints[z] += otherRolesPointsList[z];
}
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -25,15 +25,12 @@
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
@@ -82,29 +79,23 @@ class Wave
" C: ",
" H: "
};
Wave(Client client)
{
this.client = client;
}
void setWaveAmounts(int[] amounts)
{
for (int i = 0; i < amounts.length; i++)
{
waveAmounts[i] = amounts[i];
}
System.arraycopy(amounts, 0, waveAmounts, 0, amounts.length);
}
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];
}
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++)
@@ -116,6 +107,7 @@ class Wave
}
}
}
void setWavePoints()
{
for (int i = 0; i < POINTSWIDGETS.size(); i++)
@@ -179,6 +171,7 @@ class Wave
}
}
}
ChatMessageBuilder getWaveSummary()
{
ChatMessageBuilder message = new ChatMessageBuilder();

View File

@@ -156,20 +156,29 @@ public interface BAToolsConfig extends Config
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"
)
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"
)
default boolean removeHealWrongFood() { return false; }
default boolean removeHealWrongFood()
{
return false;
}
}

View File

@@ -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;
}
@@ -76,20 +75,7 @@ public class BAToolsOverlay extends Overlay
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;
}
}
Color color;
int timeLeft = healer.getLastFoodTime() - (int) Duration.between(plugin.getWave_start(), Instant.now()).getSeconds();
timeLeft = timeLeft < 1 ? 0 : timeLeft;
@@ -118,7 +104,6 @@ public class BAToolsOverlay extends Overlay
timeLeft);
OverlayUtil.renderActorOverlay(graphics, healer.getNpc(), text, color);
}
return null;

View File

@@ -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;
@@ -86,9 +87,9 @@ import org.apache.commons.lang3.ArrayUtils;
)
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,19 +161,15 @@ public class BAToolsPlugin extends Plugin implements KeyListener
@Subscribe
public void onWidgetLoaded(WidgetLoaded event)
{
switch (event.getGroupId())
{
case WidgetID.BA_REWARD_GROUP_ID:
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
{
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
if (rewardWidget != null && rewardWidget.getText().contains("<br>5"))
{
tickNum = 0;
}
}
}
}
@Subscribe
public void onGameTick(GameTick event)
@@ -211,7 +202,6 @@ public class BAToolsPlugin extends Plugin implements KeyListener
counter.setCount(tickNum);
if (config.defTimer())
{
//log.info("" + tickNum++);
tickNum++;
}
}
@@ -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,13 +382,13 @@ 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 ||
@@ -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]));
}
}
@@ -458,19 +447,26 @@ public class BAToolsPlugin extends Plugin implements KeyListener
if (itemId == ItemID.LOGS && !target.contains("healing vial"))
{
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"))
{
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
@@ -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)
@@ -712,12 +711,14 @@ 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);
int idx = searchIndex(entries, option, target, strict);
if (idx >= 0 && entries[idx] != null)
{
entries = ArrayUtils.removeElement(entries, entries[idx]);
}
}
client.setMenuEntries(entries);
}

View File

@@ -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);
}

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -113,7 +113,10 @@ public interface ClanManModeConfig extends Config
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,
@@ -121,7 +124,10 @@ public interface ClanManModeConfig extends Config
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,
@@ -129,7 +135,10 @@ public interface ClanManModeConfig extends Config
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,
@@ -137,7 +146,10 @@ public interface ClanManModeConfig extends Config
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,
@@ -145,7 +157,10 @@ public interface ClanManModeConfig extends Config
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,
@@ -153,7 +168,10 @@ public interface ClanManModeConfig extends Config
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,

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -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,9 +14,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;
@PluginDescriptor(
name = "Climb Up Climb Down",
description = "Hold Shift to Climb up, Ctrl to Climb down",
@@ -23,7 +22,8 @@ import javax.inject.Singleton;
)
@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);
}
}
}

View File

@@ -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;
}

View File

@@ -206,7 +206,7 @@ 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)
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.EXTERNAL))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
@@ -214,17 +214,16 @@ public class ConfigPanel extends PluginPanel
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);
});
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
// populate pluginList with all non-hidden plugins
pluginManager.getPlugins().stream()
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals(PluginType.PVM))
.forEach(plugin ->
@@ -234,14 +233,12 @@ public class ConfigPanel extends PluginPanel
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);
});
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
@@ -254,17 +251,15 @@ public class ConfigPanel extends PluginPanel
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);
});
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 ->
@@ -274,14 +269,12 @@ public class ConfigPanel extends PluginPanel
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);
});
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,8 +305,7 @@ 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()
@@ -325,7 +317,6 @@ public class ConfigPanel extends PluginPanel
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);
});
}

View File

@@ -24,13 +24,9 @@
*/
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
@@ -45,6 +41,7 @@ public interface EquipmentInspectorConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "protecteditems",
name = "# of protected items",
@@ -52,7 +49,10 @@ public interface EquipmentInspectorConfig extends Config
position = 2
)
default int protecteditems()
{ return 1; }
{
return 1;
}
@ConfigItem(
keyName = "ExactValue",
name = "Show exact value",
@@ -60,5 +60,7 @@ public interface EquipmentInspectorConfig extends Config
position = 3
)
default boolean ExactValue()
{ return false; }
{
return false;
}
}

View File

@@ -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
@@ -91,7 +97,7 @@ public class EquipmentInspectorPanel extends PluginPanel
public void update(Map<KitType, ItemComposition> playerEquipment, String playerName)
{
if (playerName.isEmpty() || playerName == null)
if (playerName.isEmpty())
{
nameLabel.setText(NO_PLAYER_SELECTED);
}

View File

@@ -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,15 +61,6 @@ 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,
@@ -66,10 +69,9 @@ import java.util.concurrent.ScheduledExecutorService;
@Slf4j
public class EquipmentInspectorPlugin extends Plugin {
public class EquipmentInspectorPlugin extends Plugin
{
private static final String INSPECT_EQUIPMENT = "Gear";
private static final String KICK_OPTION = "Kick";
@Inject
@Nullable
@@ -100,22 +102,22 @@ public class EquipmentInspectorPlugin extends Plugin {
private int Prot4 = 0;
@Provides
EquipmentInspectorConfig provideConfig(ConfigManager configManager) {
EquipmentInspectorConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(EquipmentInspectorConfig.class);
}
@Override
protected void startUp() throws Exception {
protected void startUp() throws Exception
{
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
if (client != null) {
if (client != null)
{
menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT);
}
//synchronized (ImageIO.class)
//{
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "normal.png");
//}
navButton = NavigationButton.builder()
.tooltip("Equipment Inspector")
@@ -130,26 +132,33 @@ public class EquipmentInspectorPlugin extends Plugin {
}
@Override
protected void shutDown() throws Exception {
protected void shutDown() throws Exception
{
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
}
@Subscribe
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) {
if (event.getMenuOption().equals(INSPECT_EQUIPMENT)) {
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{
if (event.getMenuOption().equals(INSPECT_EQUIPMENT))
{
executor.execute(() ->
{
try {
try
{
SwingUtilities.invokeAndWait(() ->
{
if (!navButton.isSelected()) {
if (!navButton.isSelected())
{
navButton.getOnSelect().run();
}
});
} catch (InterruptedException | InvocationTargetException e) {
}
catch (InterruptedException | InvocationTargetException e)
{
throw new RuntimeException(e);
@@ -164,7 +173,8 @@ public class EquipmentInspectorPlugin extends Plugin {
.filter(Objects::nonNull)
.filter(p -> p.getName().equals(finalPlayerName)).findFirst();
if (targetPlayer.isPresent()) {
if (targetPlayer.isPresent())
{
TotalPrice = 0;
Prot1 = 0;
Prot2 = 0;
@@ -173,41 +183,59 @@ public class EquipmentInspectorPlugin extends Plugin {
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) {
if (itemId != -1)
{
ItemComposition itemComposition = client.getItemDefinition(itemId);
playerEquipment.put(kitType, itemComposition);
int ItemPrice = itemManager.getItemPrice(itemId);
TotalPrice += ItemPrice;
if (ItemPrice > Prot1) {
if (ItemPrice > Prot1)
{
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = Prot1;
Prot1 = ItemPrice;
} else if (ItemPrice > Prot2) {
}
else if (ItemPrice > Prot2)
{
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = ItemPrice;
} else if (ItemPrice > Prot3) {
}
else if (ItemPrice > Prot3)
{
Prot4 = Prot3;
Prot3 = ItemPrice;
} else if (ItemPrice > Prot4) {
}
else if (ItemPrice > Prot4)
{
Prot4 = ItemPrice;
}
}
}
int IgnoredItems = config.protecteditems();
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3) {
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3)
{
IgnoredItems = 4;
}
if (config.ShowValue()) {
switch (IgnoredItems) {
if (config.ShowValue())
{
switch (IgnoredItems)
{
case 1:
TotalPrice = TotalPrice - Prot1;
break;
@@ -229,12 +257,14 @@ public class EquipmentInspectorPlugin extends Plugin {
break;
}
String StringPrice = "";
if (!config.ExactValue()) {
if (!config.ExactValue())
{
TotalPrice = TotalPrice / 1000;
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
StringPrice = StringPrice + 'K';
}
if (config.ExactValue()) {
if (config.ExactValue())
{
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
}
chatMessageManager.queue(QueuedMessage.builder()

View File

@@ -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)
{

View File

@@ -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

View File

@@ -29,7 +29,8 @@ 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,
@@ -37,7 +38,8 @@ public interface FlexoConfig extends Config {
name = "Overlay Enabled",
description = "Shows clicking area and points etc."
)
default boolean overlayEnabled() {
default boolean overlayEnabled()
{
return true;
}
@@ -47,7 +49,8 @@ public interface FlexoConfig extends Config {
name = "Min Delay",
description = "Minimum delay that is applied to every action at the end (ms)"
)
default int minDelayAmt() {
default int minDelayAmt()
{
return 45;
}
@@ -58,7 +61,8 @@ public interface FlexoConfig extends Config {
name = "Reaction Time",
description = "The base time between actions (ms)"
)
default int getReactionTimeVariation() {
default int getReactionTimeVariation()
{
return 80;
}
@@ -68,7 +72,8 @@ public interface FlexoConfig extends Config {
name = "Mouse drag speed",
description = "The speed at which steps are executed. Keep at 49? cuz jagex mouse recorder?"
)
default int getMouseDragSpeed() {
default int getMouseDragSpeed()
{
return 49;
}
@@ -79,7 +84,8 @@ public interface FlexoConfig extends Config {
name = "Overshoots",
description = "Higher number = more overshoots"
)
default int getOvershoots() {
default int getOvershoots()
{
return 4;
}
@@ -89,7 +95,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Variating",
description = ""
)
default boolean getVariatingFlow() {
default boolean getVariatingFlow()
{
return true;
}
@@ -99,7 +106,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Slow startup",
description = ""
)
default boolean getSlowStartupFlow() {
default boolean getSlowStartupFlow()
{
return true;
}
@@ -110,7 +118,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Slow startup 2",
description = ""
)
default boolean getSlowStartup2Flow() {
default boolean getSlowStartup2Flow()
{
return true;
}
@@ -120,7 +129,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Jagged",
description = ""
)
default boolean getJaggedFlow() {
default boolean getJaggedFlow()
{
return true;
}
@@ -130,7 +140,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Interrupted",
description = ""
)
default boolean getInterruptedFlow() {
default boolean getInterruptedFlow()
{
return false;
}
@@ -141,7 +152,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Interrupted 2",
description = ""
)
default boolean getInterruptedFlow2() {
default boolean getInterruptedFlow2()
{
return false;
}
@@ -151,7 +163,8 @@ public interface FlexoConfig extends Config {
name = "Flow - Stopping",
description = ""
)
default boolean getStoppingFlow() {
default boolean getStoppingFlow()
{
return false;
}
@@ -161,7 +174,8 @@ public interface FlexoConfig extends Config {
name = "Deviation slope divider",
description = ""
)
default int getDeviationSlope() {
default int getDeviationSlope()
{
return 10;
}
@@ -172,7 +186,8 @@ public interface FlexoConfig extends Config {
name = "Noisiness divider",
description = ""
)
default String getNoisinessDivider() {
default String getNoisinessDivider()
{
return "2.0D";
}
@@ -182,7 +197,8 @@ public interface FlexoConfig extends Config {
name = "Debug NPCs",
description = "Draws clickArea and clickPoints across all visible npcs"
)
default boolean getDebugNPCs() {
default boolean getDebugNPCs()
{
return false;
}
@@ -192,7 +208,8 @@ public interface FlexoConfig extends Config {
name = "Debug Players",
description = "Draws clickArea and clickPoints across all visible players"
)
default boolean getDebugPlayers() {
default boolean getDebugPlayers()
{
return false;
}
@@ -202,7 +219,8 @@ public interface FlexoConfig extends Config {
name = "Debug Ground Items",
description = "Draws clickArea and clickPoints across all visible ground items"
)
default boolean getDebugGroundItems() {
default boolean getDebugGroundItems()
{
return false;
}
}

View File

@@ -27,56 +27,64 @@
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 {
public static Rectangle clickArea;
public ArrayList<Rectangle> clickAreas = new ArrayList<>();
public ArrayList<Point> clickPoints = new ArrayList<>();
@Inject
private Client client;
@Inject
private FlexoPlugin plugin;
ArrayList<Rectangle> clickAreas = new ArrayList<>();
ArrayList<Point> clickPoints = new ArrayList<>();
@Inject
private FlexoConfig config;
@Inject
public FlexoOverlay(@Nullable Client client, FlexoPlugin plugin, FlexoConfig config) {
public FlexoOverlay(FlexoConfig config)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
this.client = client;
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics) {
if (config.getDebugNPCs() || config.getDebugGroundItems() || config.getDebugPlayers()) {
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 (clickAreas != null)
{
for (Rectangle clickArea : clickAreas)
{
if (clickArea != null)
{
graphics.draw(clickArea);
}
}
if (clickPoints!=null) {
for (Point p : clickPoints) {
if (p!=null) {
}
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));

View File

@@ -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,25 +60,23 @@ 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
)
public class FlexoPlugin extends Plugin {
public class FlexoPlugin extends Plugin
{
private Flexo flexo;
{
try {
try
{
flexo = new Flexo();
} catch (AWTException e) {
}
catch (AWTException e)
{
e.printStackTrace();
}
}
@@ -95,16 +97,22 @@ public class FlexoPlugin extends Plugin {
private FlexoOverlay overlay;
@Provides
FlexoConfig getConfig(ConfigManager configManager) {
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()) {
private void onConfigChanged(ConfigChanged event)
{
if (event.getKey().compareTo("overlayEnabled") == 0)
{
if (getConfig(configManager).overlayEnabled())
{
overlayManager.add(overlay);
} else {
}
else
{
overlayManager.remove(overlay);
}
}
@@ -113,20 +121,30 @@ public class FlexoPlugin extends Plugin {
@Subscribe
public void onBeforeRender(BeforeRender event) {
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()) {
if (getConfig(configManager).getDebugNPCs())
{
Flexo.isStretched = client.isStretchedEnabled();
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
if (flexo != null)
for (NPC npc : client.getNpcs()) {
{
for (NPC npc : client.getNpcs())
{
if (npc != null)
if (npc.getConvexHull() != null) {
{
if (npc.getConvexHull() != null)
{
Rectangle r = FlexoMouse.getClickArea(npc.getConvexHull().getBounds());
overlay.clickAreas.add(r);
java.awt.Point p = FlexoMouse.getClickPoint(r);
@@ -134,14 +152,21 @@ public class FlexoPlugin extends Plugin {
}
}
}
}
}
if (getConfig(configManager).getDebugPlayers()) {
if (getConfig(configManager).getDebugPlayers())
{
Flexo.isStretched = client.isStretchedEnabled();
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
if (flexo != null)
for (Player player : client.getPlayers()) {
{
for (Player player : client.getPlayers())
{
if (player != null)
if (player.getConvexHull() != null) {
{
if (player.getConvexHull() != null)
{
Rectangle r = FlexoMouse.getClickArea(player.getConvexHull().getBounds());
overlay.clickAreas.add(r);
java.awt.Point p = FlexoMouse.getClickPoint(r);
@@ -149,17 +174,29 @@ public class FlexoPlugin extends Plugin {
}
}
}
}
}
// Could still use some improvement
if (getConfig(configManager).getDebugGroundItems()) {
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()) {
{
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());
{
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);
@@ -169,13 +206,13 @@ public class FlexoPlugin extends Plugin {
}
}
}
@Subscribe
public void onGameTick(GameTick event) {
}
}
}
}
private void updateMouseMotionFactory() {
private void updateMouseMotionFactory()
{
Flexo.minDelay = getConfig(configManager).minDelayAmt();
MouseMotionFactory factory = new MouseMotionFactory();
// TODO:Add Options for various flows to allow more personalization
@@ -185,25 +222,39 @@ public class FlexoPlugin extends Plugin {
flows.add(new Flow(FlowTemplates.random()));
if (getConfig(configManager).getVariatingFlow())
{
flows.add(new Flow(FlowTemplates.variatingFlow()));
}
if (getConfig(configManager).getSlowStartupFlow())
{
flows.add(new Flow(FlowTemplates.slowStartupFlow()));
}
if (getConfig(configManager).getSlowStartup2Flow())
{
flows.add(new Flow(FlowTemplates.slowStartup2Flow()));
}
if (getConfig(configManager).getJaggedFlow())
{
flows.add(new Flow(FlowTemplates.jaggedFlow()));
}
if (getConfig(configManager).getInterruptedFlow())
{
flows.add(new Flow(FlowTemplates.interruptedFlow()));
}
if (getConfig(configManager).getInterruptedFlow2())
{
flows.add(new Flow(FlowTemplates.interruptedFlow2()));
}
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
@@ -220,14 +271,16 @@ public class FlexoPlugin extends Plugin {
}
@Override
protected void startUp() throws Exception {
protected void startUp() throws Exception
{
Flexo.isStretched = client.isStretchedEnabled();
overlayManager.add(overlay);
updateMouseMotionFactory();
}
@Override
protected void shutDown() throws Exception {
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
}
}

View File

@@ -50,7 +50,7 @@ public class FlinchingOverlay extends Overlay
private Color color;
private Color borderColor;
private int overlaySize = 25;
private int overlaySize;
@Inject
FlinchingOverlay(Client client, FlinchingPlugin plugin, FlinchingConfig config)

View File

@@ -24,28 +24,28 @@
*/
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
@@ -73,7 +73,7 @@ public class FlinchingPlugin extends Plugin
private int currentWorld = -1;
private int currentInteractingId = -1;
private final Map<Integer, FlinchingTarget> flinchingTargets = new HashMap<Integer, FlinchingTarget>();
private final Map<Integer, FlinchingTarget> flinchingTargets = new HashMap<>();
private boolean resetOnHit = true;
private boolean resetOnHitReceived = true;
@@ -111,10 +111,9 @@ public class FlinchingPlugin extends Plugin
resetOnHit = config.getFlinchResetOnHit();
resetOnHitReceived = config.getFlinchResetOnHitReceived();
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
while (it.hasNext())
for (Map.Entry<Integer, FlinchingTarget> integerFlinchingTargetEntry : flinchingTargets.entrySet())
{
FlinchingTarget target = it.next().getValue();
FlinchingTarget target = integerFlinchingTargetEntry.getValue();
if (target != null)
{
target.SetDelayTime(config.getFlinchDelay(), config.getFlinchAttackedDelay());
@@ -152,16 +151,14 @@ public class FlinchingPlugin extends Plugin
@Subscribe
private void onGameTick(GameTick tick)
{
if (client.getGameState() != GameState.LOGGED_IN)
if (client.getGameState() == GameState.LOGGED_IN)
{
return;
}
else
{
TickTargets();
checkInteracting();
}
}
@Subscribe
public void onHitsplatApplied(HitsplatApplied hitsplatApplied)
@@ -229,7 +226,7 @@ public class FlinchingPlugin extends Plugin
if (target != null)
{
target.Tick();
if(target.isActive == false)
if (!target.isActive)
{
it.remove();
}
@@ -265,12 +262,11 @@ public class FlinchingPlugin extends Plugin
flinchingTargets.put(_newTarget.getId(), newTarget);
}
public void PlayerHit()
private void PlayerHit()
{
Iterator<Map.Entry<Integer, FlinchingTarget>> it = flinchingTargets.entrySet().iterator();
while (it.hasNext())
for (Map.Entry<Integer, FlinchingTarget> integerFlinchingTargetEntry : flinchingTargets.entrySet())
{
FlinchingTarget target = it.next().getValue();
FlinchingTarget target = integerFlinchingTargetEntry.getValue();
if (target != null)
{
target.PlayerHit();
@@ -278,7 +274,7 @@ public class FlinchingPlugin extends Plugin
}
}
public Map<Integer, FlinchingTarget> GetTargets()
Map<Integer, FlinchingTarget> GetTargets()
{
return (flinchingTargets);
}

View File

@@ -40,7 +40,7 @@ public class FlinchingTarget
private int displayHitReceivedLength = 6600;
private Instant lastAttacked;
public boolean isActive = false;
public boolean isActive;
@Getter
private int objectId;
@@ -49,7 +49,7 @@ public class FlinchingTarget
@Getter
public WorldPoint worldLocation;
public FlinchingTarget(NPC target)
FlinchingTarget(NPC target)
{
isActive = true;
@@ -59,7 +59,7 @@ public class FlinchingTarget
this.worldLocation = target.getWorldLocation();
}
public void TargetHit()
void TargetHit()
{
boolean shouldHit = true;
if (usingHitDelay)
@@ -79,7 +79,7 @@ public class FlinchingTarget
}
}
public double GetRemainingTimePercent()
double GetRemainingTimePercent()
{
double remainingTime = GetRemainingTime();
double timePercent = remainingTime / currentDisplayLength;
@@ -101,7 +101,7 @@ public class FlinchingTarget
return ((currentDisplayLength - ((double) duration.toMillis())));
}
public void Tick()
void Tick()
{
if (targetObject == null)
{
@@ -119,7 +119,7 @@ public class FlinchingTarget
}
}
public void SetDelayTime(int delayTime, int delayHitReceivedTime)
void SetDelayTime(int delayTime, int delayHitReceivedTime)
{
displayLength = delayTime;
displayHitReceivedLength = delayHitReceivedTime;
@@ -134,7 +134,7 @@ public class FlinchingTarget
}
}
public void PlayerHit()
void PlayerHit()
{
usingHitDelay = true;
currentDisplayLength = displayHitReceivedLength;

View File

@@ -29,14 +29,8 @@ 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,
@@ -44,7 +38,10 @@ public interface HydraConfig extends Config {
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,
@@ -52,7 +49,10 @@ public interface HydraConfig extends Config {
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,
@@ -60,6 +60,8 @@ public interface HydraConfig extends Config {
name = "Prayer Helper",
description = "Configures if prayer helper is shown or not."
)
default boolean PrayerHelper() { return true; }
default boolean PrayerHelper()
{
return true;
}
}

View File

@@ -24,30 +24,25 @@
*/
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 {
public class HydraIndicatorOverlay extends Overlay
{
private final HydraConfig config;
private final HydraPlugin plugin;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
private HydraIndicatorOverlay(HydraConfig config, HydraPlugin plugin) {
private HydraIndicatorOverlay(HydraConfig config, HydraPlugin plugin)
{
this.config = config;
this.plugin = plugin;
setPosition(OverlayPosition.BOTTOM_RIGHT);
@@ -56,15 +51,20 @@ public class HydraIndicatorOverlay extends Overlay {
}
@Override
public Dimension render(Graphics2D graphics) {
if (!config.PrayerHelper()) {
public Dimension render(Graphics2D graphics)
{
if (!config.PrayerHelper())
{
return null;
}
if (plugin.Hydra != null) {
if (plugin.hydras.containsKey(plugin.Hydra.getIndex())) {
if (plugin.Hydra != null)
{
if (plugin.hydras.containsKey(plugin.Hydra.getIndex()))
{
int val = plugin.hydras.get(plugin.Hydra.getIndex());
if (val != 0) {
if (val != 0)
{
panelComponent.getChildren().clear();
panelComponent.getChildren().add(LineComponent.builder().right(Integer.toString(val)).build());
return panelComponent.render(graphics);

View File

@@ -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);
}
}
}

View File

@@ -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())) {
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
{
if (hydra.getName().equalsIgnoreCase("Hydra"))
{
hydras.remove(hydra.getIndex());
}
if (hydraattacks.containsKey(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);
}
}

View File

@@ -24,19 +24,24 @@
*/
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 {
public class HydraPrayOverlay extends Overlay
{
private final HydraConfig config;
private final HydraPlugin plugin;
@@ -50,7 +55,8 @@ public class HydraPrayOverlay extends Overlay {
private Client client;
@Inject
private HydraPrayOverlay(HydraConfig config, HydraPlugin plugin, SpriteManager spriteManager) {
private HydraPrayOverlay(HydraConfig config, HydraPlugin plugin, SpriteManager spriteManager)
{
this.config = config;
this.plugin = plugin;
setPosition(OverlayPosition.BOTTOM_RIGHT);
@@ -59,19 +65,27 @@ public class HydraPrayOverlay extends Overlay {
}
@Override
public Dimension render(Graphics2D graphics) {
if (!config.PrayerHelper()) {
public Dimension render(Graphics2D graphics)
{
if (!config.PrayerHelper())
{
return null;
}
if (plugin.Hydra != null) {
if (plugin.hydras.containsKey(plugin.Hydra.getIndex())) {
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())) {
if (val != 0)
{
if (plugin.hydraattacks.containsKey(plugin.Hydra.getIndex()))
{
int attack = plugin.hydraattacks.get(plugin.Hydra.getIndex());
if (attack == 8261) {
if (val == 3) {
if (attack == 8261)
{
if (val == 3)
{
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
imagePanelComponent.getChildren().clear();
@@ -81,7 +95,9 @@ public class HydraPrayOverlay extends Overlay {
: NOT_ACTIVATED_BACKGROUND_COLOR);
return imagePanelComponent.render(graphics);
} else {
}
else
{
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
imagePanelComponent.getChildren().clear();
@@ -92,8 +108,11 @@ public class HydraPrayOverlay extends Overlay {
return imagePanelComponent.render(graphics);
}
} else if (attack == 8262) {
if (val == 3) {
}
else if (attack == 8262)
{
if (val == 3)
{
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
imagePanelComponent.getChildren().clear();
@@ -103,7 +122,9 @@ public class HydraPrayOverlay extends Overlay {
: NOT_ACTIVATED_BACKGROUND_COLOR);
return imagePanelComponent.render(graphics);
} else {
}
else
{
final BufferedImage prayerImage = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
imagePanelComponent.getChildren().clear();

View File

@@ -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;
}
}

View File

@@ -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--)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;
}
}

View File

@@ -74,13 +74,18 @@ class LootingBagViewerOverlay extends Overlay
{
if(client.getItemContainer(InventoryID.LOOTING_BAG) != null) {
itemContainer = client.getItemContainer(InventoryID.LOOTING_BAG);
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);
if (itemContainer != null)
{
Item[] tempItems = itemContainer.getItems();
for (int i = 0; i < items.length; i++)
@@ -91,6 +96,7 @@ class LootingBagViewerOverlay extends Overlay
}
}
}
}
panelComponent.getChildren().clear();

View File

@@ -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; }
}

View File

@@ -24,12 +24,11 @@
*/
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;

View File

@@ -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,12 +44,6 @@ 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",
@@ -98,37 +93,55 @@ public class MenuModifierPlugin extends Plugin
Player localPlayer = client.getLocalPlayer();
if (localPlayer == null)
{
return;
}
if (!(MiscUtils.getWildernessLevelFrom(client, localPlayer.getWorldLocation()) >= 0))
{
return;
}
if (hotKeyPressed)
{
return;
}
List<MenuEntry> menu_entries = new ArrayList<MenuEntry>();
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();
@@ -136,7 +149,9 @@ public class MenuModifierPlugin extends Plugin
Player player = null;
if (identifier >= 0 && identifier < players.length)
{
player = players[identifier];
}
if (player == null)
{
@@ -145,7 +160,9 @@ public class MenuModifierPlugin extends Plugin
}
if ((option.contains("attack") || option.contains("cast")) && (player.isFriend() || player.isClanMember()))
{
continue;
}
menu_entries.add(entry);
}

View File

@@ -24,17 +24,14 @@
*/
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 {
Color rlDefault = new Color(250, 155, 23);
public interface PluginSorterConfig extends Config
{
boolean pluginsHidden = false;
@ConfigItem(

View File

@@ -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,22 +41,16 @@ 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
)
public class PluginSorterPlugin extends Plugin {
public class PluginSorterPlugin extends Plugin
{
//Cache the hidden plugins
public static List<PluginListItem> removedPlugins = new ArrayList<>();
private static List<PluginListItem> removedPlugins = new ArrayList<>();
@Inject
private PluginSorterConfig config;
@@ -78,29 +76,41 @@ public class PluginSorterPlugin extends Plugin {
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState()== GameState.LOGIN_SCREEN) {
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()) {
public void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getKey().equals("hidePlugins"))
{
if (config.hidePlugins())
{
hidePlugins();
} else {
}
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;
@@ -121,11 +131,14 @@ public class PluginSorterPlugin extends Plugin {
}
}
public void hidePlugins() {
private void hidePlugins()
{
Iterator<PluginListItem> iter = ConfigPanel.pluginList.iterator();
while (iter.hasNext()) {
while (iter.hasNext())
{
PluginListItem pli = iter.next();
if (pli.getPlugin() != null) {
if (pli.getPlugin() != null)
{
switch (pli.getPlugin().getClass().getAnnotation(PluginDescriptor.class).type())
{
case PVM:
@@ -143,7 +156,8 @@ public class PluginSorterPlugin extends Plugin {
}
}
public void showPlugins() {
private void showPlugins()
{
List<PluginListItem> tempList = new ArrayList<>();
tempList.addAll(removedPlugins);
tempList.addAll(ConfigPanel.pluginList);

View File

@@ -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;
}
}

View File

@@ -24,21 +24,24 @@
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."
)
default Color attackerPlayerColor() { return new Color(0xFF0006); }
default Color attackerPlayerColor()
{
return new Color(0xFF0006);
}
@ConfigItem(
position = 1,
@@ -46,16 +49,21 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Potential Attacker color",
description = "This is the color that will be used to highlight potential attackers."
)
default Color potentialPlayerColor() { return new Color(0xFFFF00); }
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 int attackerTargetTimeout()
{
return 10;
}
@ConfigItem(
position = 3,
@@ -63,7 +71,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Potential Attacker Timeout",
description = "Seconds until potential attacker is no longer highlighted."
)
default int potentialTargetTimeout() { return 10; }
default int potentialTargetTimeout()
{
return 10;
}
@ConfigItem(
position = 4,
@@ -71,17 +82,21 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "New Player Timeout",
description = "Seconds until logged in/spawned player is no longer highlighted."
)
default int newSpawnTimeout() { return 5; }
////
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 boolean ignoreFriends()
{
return true;
}
@ConfigItem(
position = 6,
@@ -89,8 +104,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Ignore Clan Mates",
description = "This lets you decide whether you want clan mates to be highlighted by this plugin."
)
default boolean ignoreClanMates() { return true; }
////
default boolean ignoreClanMates()
{
return true;
}
@ConfigItem(
position = 7,
@@ -98,7 +115,10 @@ public interface PrayAgainstPlayerConfig extends Config {
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 markNewPlayer() { return false; }
default boolean markNewPlayer()
{
return false;
}
@ConfigItem(
position = 8,
@@ -106,7 +126,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw what to pray on attacker",
description = "Tells you what to pray from what weapon the attacker is holding"
)
default boolean drawTargetPrayAgainst() { return true; }
default boolean drawTargetPrayAgainst()
{
return true;
}
@ConfigItem(
position = 9,
@@ -114,7 +137,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw what to pray on potential attacker",
description = "Tells you what to pray from what weapon the potential attacker is holding"
)
default boolean drawPotentialTargetPrayAgainst() { return true; }
default boolean drawPotentialTargetPrayAgainst()
{
return true;
}
@ConfigItem(
position = 10,
@@ -122,7 +148,10 @@ public interface PrayAgainstPlayerConfig extends Config {
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 drawTargetPrayAgainstPrayerTab() { return false; }
default boolean drawTargetPrayAgainstPrayerTab()
{
return false;
}
@ConfigItem(
position = 11,
@@ -130,7 +159,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw name on attacker",
description = "Configures whether or not the attacker\'s name should be shown"
)
default boolean drawTargetsName() { return true; }
default boolean drawTargetsName()
{
return true;
}
@ConfigItem(
position = 12,
@@ -138,7 +170,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw name on potential attacker",
description = "Configures whether or not the potential attacker\'s name should be shown"
)
default boolean drawPotentialTargetsName() { return true; }
default boolean drawPotentialTargetsName()
{
return true;
}
@ConfigItem(
position = 13,
@@ -146,7 +181,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw highlight around attacker",
description = "Configures whether or not the attacker should be highlighted"
)
default boolean drawTargetHighlight() { return true; }
default boolean drawTargetHighlight()
{
return true;
}
@ConfigItem(
position = 14,
@@ -154,7 +192,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw highlight around potential attacker",
description = "Configures whether or not the potential attacker should be highlighted"
)
default boolean drawPotentialTargetHighlight() { return true; }
default boolean drawPotentialTargetHighlight()
{
return true;
}
@ConfigItem(
position = 15,
@@ -162,7 +203,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw tile under attacker",
description = "Configures whether or not the attacker\'s tile be highlighted"
)
default boolean drawTargetTile() { return false; }
default boolean drawTargetTile()
{
return false;
}
@ConfigItem(
position = 16,
@@ -170,7 +214,10 @@ public interface PrayAgainstPlayerConfig extends Config {
name = "Draw tile under potential attacker",
description = "Configures whether or not the potential attacker\'s tile be highlighted"
)
default boolean drawPotentialTargetTile() { return false; }
default boolean drawPotentialTargetTile()
{
return false;
}
@ConfigItem(
position = 17,
@@ -178,6 +225,8 @@ public interface PrayAgainstPlayerConfig extends Config {
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; }
default boolean drawUnknownWeapons()
{
return false;
}
}

View File

@@ -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())) {
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());
}
} catch (ConcurrentModificationException e) {
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 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())) {
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());
}
} catch (ConcurrentModificationException e) {
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 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)
{
}
}

View File

@@ -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) {
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())) {
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);
}

View File

@@ -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,24 +55,20 @@ 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
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,
@@ -62,7 +77,7 @@ public class PrayAgainstPlayerPlugin extends Plugin {
};
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;
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 ((sourcePlayer.getAnimation() != -1) && (!isBlockAnimation(sourcePlayer.getAnimation())))
{
// if attacker attacks again, reset his timer so overlay doesn't go away
if (findPlayerInAttackerList(sourcePlayer) != null) {
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 (!potentialPlayersAttackingMe.isEmpty() && potentialPlayersAttackingMe.contains(findPlayerInPotentialList(sourcePlayer)))
{
removePlayerFromPotentialContainer(findPlayerInPotentialList(sourcePlayer));
}
// if he's not in the attackers list, add him
if (findPlayerInAttackerList(sourcePlayer) == null) {
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) {
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)) {
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;
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,45 +312,30 @@ 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(),
@@ -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:

View File

@@ -33,6 +33,7 @@ public interface PrayerAlertConfig extends Config
{
return false;
}
@ConfigItem(
position = 2,
keyName = "oldRenderMode",

View File

@@ -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;
@@ -56,32 +62,42 @@ class PrayerAlertOverlay extends Overlay
panelComponent.getChildren().clear();
int prayerLevel = getPrayerLevel();
int prayerPoints = getPrayerPoints();
if (config.oldRenderMode()){
if (config.alwaysShowAlert()){
if (config.oldRenderMode())
{
if (config.alwaysShowAlert())
{
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
if (drink) {
if (drink)
{
oldPrayerRestorePanel(graphics);
}
}
else {
else
{
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
boolean hasPrayerPotion = checkInventoryForPotion();
if (drink && hasPrayerPotion) {
if (drink && hasPrayerPotion)
{
oldPrayerRestorePanel(graphics);
}
}
}
else{
if (config.alwaysShowAlert()){
else
{
if (config.alwaysShowAlert())
{
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
if (drink) {
if (drink)
{
prayerRestorePanel(panelComponent, graphics);
}
}
else {
else
{
boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints);
boolean hasPrayerPotion = checkInventoryForPotion();
if (drink && hasPrayerPotion) {
if (drink && hasPrayerPotion)
{
prayerRestorePanel(panelComponent, graphics);
}
}
@@ -143,7 +159,8 @@ class PrayerAlertOverlay extends Overlay
return hasPrayerPotion;
}
private void prayerRestorePanel(PanelComponent panelComponent, Graphics2D graphics){
private void prayerRestorePanel(PanelComponent panelComponent, Graphics2D graphics)
{
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.PRAYER_POTION4)));
panelComponent.getChildren().add(TitleComponent.builder()
.text("Drink")
@@ -153,7 +170,8 @@ class PrayerAlertOverlay extends Overlay
graphics.getFontMetrics().stringWidth("Drink") + 12, 0));
}
private void oldPrayerRestorePanel(Graphics2D graphics){
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);

View File

@@ -18,9 +18,9 @@ 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;
@@ -39,9 +39,6 @@ public class PrayerAlertPlugin extends Plugin
@Inject
private PrayerAlertOverlay overlay;
@Inject
private PrayerAlertConfig config;
@Provides
PrayerAlertConfig provideConfig(ConfigManager configManager)
{

View File

@@ -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)

View File

@@ -31,8 +31,6 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup("profiles")
public interface ProfilesConfig extends Config
{
@ConfigItem(
keyName = "profilesData",
name = "",

View File

@@ -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;
@@ -81,12 +86,10 @@ class ProfilesPanel extends PluginPanel
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
@@ -108,6 +111,7 @@ 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());
@@ -119,7 +123,6 @@ class ProfilesPanel extends PluginPanel
c.gridy = c.gridy + 3;
c.gridy++;
txtDecryptPassword.setEchoChar((char) 0);
txtDecryptPassword.setPreferredSize(PREFERRED_SIZE);
txtDecryptPassword.setForeground(ColorScheme.MEDIUM_GRAY_COLOR);
@@ -154,6 +157,7 @@ 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);
@@ -413,7 +417,7 @@ class ProfilesPanel extends PluginPanel
// addAccounts(config.profilesData());
}
void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException
private void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException
{
profilesPanel.removeAll();
c.gridy = 0;
@@ -433,7 +437,7 @@ class ProfilesPanel extends PluginPanel
repaint();
}
void addAccounts(String data)
private void addAccounts(String data)
{
// log.info("Data: " + data);
data = data.trim();
@@ -444,7 +448,7 @@ 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");
@@ -459,12 +463,12 @@ class ProfilesPanel extends PluginPanel
}
void setSalt(byte[] bytes)
private void setSalt(byte[] bytes)
{
profilesConfig.salt(base64Encode(bytes));
}
byte[] getSalt()
private byte[] getSalt()
{
if (profilesConfig.salt().length() == 0)
{
@@ -473,7 +477,7 @@ class ProfilesPanel extends PluginPanel
return base64Decode(profilesConfig.salt());
}
SecretKey getAesKey() throws NoSuchAlgorithmException, InvalidKeySpecException
private SecretKey getAesKey() throws NoSuchAlgorithmException, InvalidKeySpecException
{
if (getSalt().length == 0)
{
@@ -483,11 +487,10 @@ 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("¬"))
@@ -503,7 +506,7 @@ 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))
{
@@ -512,18 +515,20 @@ class ProfilesPanel extends PluginPanel
}
byte[] enc = encryptText(data, getAesKey());
if (enc.length == 0)
{
return false;
}
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);
}
@@ -534,7 +539,7 @@ class ProfilesPanel extends PluginPanel
* @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
{
@@ -550,7 +555,7 @@ 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
{
@@ -566,7 +571,7 @@ 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,

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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()
@@ -125,17 +122,18 @@ 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",
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()

View File

@@ -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;

View File

@@ -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");

View File

@@ -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
*/
@@ -174,22 +167,10 @@ 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();
ArrayList<String> missingMembers = new ArrayList<>();
for (ClanMember clanMember : client.getClanMembers())
{
if (!Objects.isNull(clanMember))
@@ -206,15 +187,12 @@ 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();
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);
@@ -416,48 +389,30 @@ public class PvpToolsPlugin extends Plugin
{
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);
moveEntry();
}
if (config.attackOptionsClan() && player.isClanMember())
{
moveEntry(mtarget);
moveEntry();
}
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);
}

View File

@@ -39,7 +39,10 @@ public interface RuneLitePlusConfig extends Config
name = "RL+ Presence",
description = "Represent RL+ with a custom icon and discord presence."
)
default boolean customPresence() { return false; }
default boolean customPresence()
{
return false;
}
@ConfigItem(
keyName = "enableOpacity",

View File

@@ -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
@@ -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();

View File

@@ -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,6 +134,7 @@ 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 worldPoints - Worldpoints in the current scene
* @return an ArrayList of Tiles where current player can attack actor but actor cannot attack local player

View File

@@ -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

View File

@@ -1,14 +1,14 @@
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 {
public interface TickCounterConfig extends Config
{
@ConfigItem(
keyName = "resetInstance",
name = "Reset on new instances",
@@ -19,6 +19,7 @@ public interface TickCounterConfig extends Config {
{
return true;
}
@Alpha
@ConfigItem(
keyName = "selfColor",
@@ -30,6 +31,7 @@ public interface TickCounterConfig extends Config {
{
return Color.green;
}
@Alpha
@ConfigItem(
keyName = "totalColor",
@@ -41,6 +43,7 @@ public interface TickCounterConfig extends Config {
{
return Color.RED;
}
@Alpha
@ConfigItem(
keyName = "otherColor",
@@ -52,6 +55,7 @@ public interface TickCounterConfig extends Config {
{
return Color.white;
}
@Alpha
@ConfigItem(
keyName = "bgColor",
@@ -63,6 +67,7 @@ public interface TickCounterConfig extends Config {
{
return new Color(70, 61, 50, 156);
}
@Alpha
@ConfigItem(
keyName = "titleColor",

View File

@@ -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) {
list.sort((o1, o2) -> {
int value = -Integer.compare(o1.getValue(), o2.getValue());
if (value == 0)
{
value = o1.getKey().compareTo(o2.getKey());
return value;
}
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());
}

View File

@@ -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;
@@ -27,49 +25,62 @@ import net.runelite.client.ui.overlay.OverlayManager;
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:
@@ -162,33 +182,43 @@ public class TickCounterPlugin extends Plugin {
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();
}
}

View File

@@ -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;
}
}

View File

@@ -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,12 +39,8 @@ 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);

View File

@@ -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,24 +41,14 @@ 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
)
public class VetionPlugin extends Plugin {
@Inject
private Client client;
@Inject
private VetionConfig config;
public class VetionPlugin extends Plugin
{
@Inject
private OverlayManager overlayManager;
@@ -63,12 +59,6 @@ public class VetionPlugin extends Plugin {
@Getter
private Map<Actor, Instant> vetions;
@Provides
VetionConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(VetionConfig.class);
}
@Override
protected void startUp()
{
@@ -87,7 +77,7 @@ public class VetionPlugin extends Plugin {
@Subscribe
public void onAnimationChanged(AnimationChanged event)
{
if (config.eartquakeTimerActive() && event.getActor().getAnimation() == AnimationID.VETION_EARTHQUAKE)
if (event.getActor().getAnimation() == AnimationID.VETION_EARTHQUAKE)
{
Actor vet = event.getActor();
vetions.remove(vet, Instant.now());

View File

@@ -159,6 +159,5 @@ public interface WarIndicatorConfig extends Config
name = "",
description = ""
)
void setTargetedSnipe(String key);
}

View File

@@ -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

View File

@@ -24,36 +24,21 @@
*/
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",
@@ -100,16 +85,16 @@ public class WarIndicatorPlugin extends Plugin
}
@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()

View File

@@ -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());
}

View File

@@ -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
{

View File

@@ -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

View File

@@ -10,13 +10,12 @@
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;
@@ -45,7 +43,8 @@ import net.runelite.client.util.WildernessLocation;
name = "Wild Locations",
description = "Indicates the players current location in the wild",
tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"},
type = PluginType.PVP
type = PluginType.PVP,
enabledByDefault = false
)
public class WildernessLocationsPlugin extends Plugin
{
@@ -57,7 +56,7 @@ public class WildernessLocationsPlugin extends Plugin
OverlayManager overlayManager;
@Inject
private WildernessLocationsOverlay overlay = new WildernessLocationsOverlay(this.client, this);
private WildernessLocationsOverlay overlay = new WildernessLocationsOverlay(this);
@Getter
private boolean renderLocation;
@@ -76,7 +75,6 @@ public class WildernessLocationsPlugin extends Plugin
private String oldChat = "";
private int currentCooldown = 0;
private final int COOLDOWN_TICKS = 30;
private WorldPoint worldPoint = null;
private final HashMap<WorldArea, String> wildLocs = getLocationMap();
@@ -234,6 +232,6 @@ public class WildernessLocationsPlugin extends Plugin
return;
}
sendMessage("/World: " + client.getWorld() + " Location: " + location);
currentCooldown = COOLDOWN_TICKS;
currentCooldown = 30;
}
}

View File

@@ -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",

View File

@@ -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;

View File

@@ -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;
@@ -90,7 +84,6 @@ public class ClientLoader
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;
@@ -116,12 +109,11 @@ public class ClientLoader
File hijackedClientFile = ByteCodeUtils.hijackedClientFile;
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
target = new JarOutputStream(new FileOutputStream(injectedClientFile), manifest);
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);
@@ -183,11 +175,14 @@ public class ClientLoader
if (!file.getValue().equals(ourHash))
{
if (hijackedClientFile.exists()) {
if (hijackedClientFile.exists())
{
Logger.getAnonymousLogger().warning("[RuneLitePlus] Hash checking / Client patching skipped due to hijacked client.");
updateCheckMode = VANILLA;
break;
} else {
}
else
{
log.info("{} had a hash mismatch; falling back to vanilla. {} != {}", file.getKey(), file.getValue(), ourHash);
log.info("Client is outdated!");
updateCheckMode = VANILLA;
@@ -221,37 +216,44 @@ public class ClientLoader
++patchCount;
if (!file.getKey().startsWith("META")) {
if (!file.getKey().startsWith("META"))
{
add(file.getValue(), file.getKey(), target);
}
}
if (target!=null)
target.close();
log.info("Patched {} classes", patchCount);
}
if (hooksFile.exists()) {
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);
if (hooks.clientInstance.equals("") ||
hooks.clientClass.equals("") ||
hooks.projectileClass.equals("") ||
hooks.actorClass.equals("") ||
hooks.playerClass.equals("")) {
System.out.println("[RuneLitePlus] Bad hooks, re-scraping.");
hooks.playerClass.equals(""))
{
log.info("[RuneLitePlus] Bad hooks, re-scraping.");
stepCount = getStepCount(ByteCodeUtils.injectedClientFile.getPath());
ByteCodePatcher.clientInstance = initHookScrape(ByteCodeUtils.injectedClientFile.getPath());
ByteCodePatcher.findHooks(injectedClientFile.getPath());
} else {
}
else
{
ByteCodePatcher.clientInstance = hooks.clientInstance;
ByteCodePatcher.applyHooks(ByteCodeUtils.injectedClientFile, hooks);
System.out.println("[RuneLitePlus] Loaded hooks");
log.info("[RuneLitePlus] Loaded hooks");
}
} else {
System.out.println("[RuneLitePlus] Hooks file not found, scraping 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;
@@ -263,16 +265,20 @@ public class ClientLoader
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 {
private void add(byte[] bytes, String entryName, JarOutputStream target) throws IOException
{
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 static int getStepCount(String jarFile)
{
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt"));
return certificates.toArray(new Certificate[certificates.size()]);
}
public 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) {
}
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 {
try
{
ClassPool classPool = new ClassPool(true);
classPool.appendClassPath(RuneLite.RUNELITE_DIR + "/injectedClient-" + RuneLiteAPI.getVersion() + "-.jar");
} catch (NotFoundException e) {
}
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"))
{
File temp = new File(jarFile);
ClassLoader cl = ClassLoader.getSystemClassLoader();
try {
try
{
URLClassLoader child = new URLClassLoader(
new URL[]{temp.toURI().toURL()},
cl
);
try {
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 {
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());
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") {
if (f.getType().getName().equals("client"))
{
ByteCodePatcher.hooks.clientInstance = classToLoad.getName() + "." + f.getName();
clientInstance = classToLoad.getName() + "." + f.getName();
}
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
}
}
for (Method m : methods) {
for (Method m : methods)
{
RuneLite.splashScreen.setSubMessage("Checked " + m.getName());
if (m.getName().contains("$")) {
if (m.getName().contains("$"))
{
protectedStuff.add(classToLoad.getName() + "." + m.getName());
}
}
RuneLite.splashScreen.setProgress(currentStep, stepCount);
} catch (FileNotFoundException e) {
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
}
RuneLite.splashScreen.setProgress(2, 5);
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Class not found: "+entry.getName());
log.info("Class not found: " + entry.getName());
}
}
}
}
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
}
int i = 0;
for (Object o : protectedStuff) {
for (String ignored : protectedStuff)
{
i++;
}
preotectedStuffs = new String[i];
i = 0;
for (Object o : protectedStuff) {
preotectedStuffs[i] = (String) o;
for (String o : protectedStuff)
{
preotectedStuffs[i] = o;
i++;
}
return clientInstance;
}
}

View File

@@ -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,87 +15,120 @@ 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
);
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
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) {
}
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());
checkClasses(new File(jf), entry);
@@ -117,112 +136,163 @@ public class ByteCodePatcher {
}
}
}
} 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
);
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 {
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) {
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) {
}
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 {
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) {
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) {
}
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) {
}
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);
}
}

View File

@@ -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,97 +15,125 @@ 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 {
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 void updateHijackedJar() {
static void updateHijackedJar()
{
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
try {
try
{
target = new JarOutputStream(new FileOutputStream(hijackedClientFile), manifest);
} catch (IOException e) {
}
catch (IOException e)
{
e.printStackTrace();
}
try {
List<String> classesToSkip = new ArrayList<>();
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
classesToSkip.add(ct.getName());
}
try
{
JarFile original = new JarFile(injectedClientFile);
Enumeration<JarEntry> entries = original.entries();
while (entries.hasMoreElements()) {
while (entries.hasMoreElements())
{
JarEntry entry = entries.nextElement();
boolean skip = false;
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
if ((ct.getName()+".class").equals(entry.getName())) {
for (CtClass ct : ByteCodePatcher.modifiedClasses)
{
if ((ct.getName() + ".class").equals(entry.getName()))
{
skip = true;
}
}
if (!skip)
{
add(entry);
}
}
for (CtClass ct : ByteCodePatcher.modifiedClasses) {
for (CtClass ct : ByteCodePatcher.modifiedClasses)
{
add(ct);
}
target.close();
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static void add(CtClass ct) {
try {
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) {
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static void add(JarEntry entry) throws IOException {
try {
if (!entry.getName().startsWith("META")&&!entry.getName().equals("")) {
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) {
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static byte[] getBytesFromZipFile(String entryName) {
private static byte[] getBytesFromZipFile(String entryName)
{
ZipFile zipFile;
try {
try
{
zipFile = new ZipFile(injectedClientFile);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while(entries.hasMoreElements()){
while (entries.hasMoreElements())
{
ZipEntry entry = entries.nextElement();
if (entry.getName().equals(entryName)) {
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) {
while ((nRead = stream.read(data, 0, data.length)) != -1)
{
buffer.write(data, 0, nRead);
}
buffer.flush();
return buffer.toByteArray();
}
}
} catch (IOException e) {
}
catch (IOException e)
{
e.printStackTrace();
}
return null;

View File

@@ -7,6 +7,7 @@ public class Hooks {
public String projectileClass = "";
public String playerClass = "";
public String[] protectedStuff;
public String clientClass = "";
public Hooks() {
}

View File

@@ -5,14 +5,19 @@ 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 {
@Slf4j
public class ActorTransform implements Transform
{
private CtClass ct;
@Override
public void modify(Class actor) {
try {
public void modify(Class actor)
{
try
{
ct = ByteCodePatcher.classPool.get(actor.getName());
transformGetAnimation();
@@ -20,7 +25,9 @@ public class ActorTransform implements Transform {
transformGraphicChanged();
ByteCodePatcher.modifiedClasses.add(ct);
} catch (CannotCompileException | NotFoundException e) {
}
catch (CannotCompileException | NotFoundException e)
{
e.printStackTrace();
}
}
@@ -36,8 +43,19 @@ public class ActorTransform implements Transform {
CtMethod getAnimation = ct.getDeclaredMethod("getAnimation");
ct.removeMethod(getAnimation);
getAnimation = CtNewMethod.make("public int getAnimation() { return this.getRsAnimation(); }",ct);
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()
);
}
@@ -47,11 +65,20 @@ public class ActorTransform implements Transform {
ct.removeMethod(getAnimationChanged);
getAnimationChanged = CtNewMethod.make(
"public void animationChanged(int n) { " +
"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);
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
@@ -60,11 +87,20 @@ public class ActorTransform implements Transform {
ct.removeMethod(graphicChanged);
graphicChanged = CtNewMethod.make(
"public void graphicChanged(int paramInt){" +
"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);
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()
);
}
}

View File

@@ -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();
@@ -36,7 +41,9 @@ public class ClientTransform implements Transform {
transformcheckClickBox();
ByteCodePatcher.modifiedClasses.add(ct);
} catch (Exception e) {
}
catch (Exception e)
{
e.printStackTrace();
}
}
@@ -50,6 +57,13 @@ 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
@@ -82,7 +96,13 @@ public class ClientTransform implements Transform {
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");
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
private void transformProtectedGetMenuTargets() throws CannotCompileException, NotFoundException
@@ -94,6 +114,13 @@ 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
@@ -111,6 +138,13 @@ public class ClientTransform implements Transform {
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
@@ -136,6 +177,13 @@ public class ClientTransform implements Transform {
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,7 +229,8 @@ public class ClientTransform implements Transform {
ct.removeMethod(getMenuEntries);
getMenuEntries = CtMethod.make(
"public net.runelite.api.MenuEntry[] getMenuEntries() {" +
"public net.runelite.api.MenuEntry[] getMenuEntries()" +
"{" +
" int n2 = this.getMenuOptionCount();" +
" String[] arrstring = this.getMenuOptions();" +
" String[] arrstring2 = this.getMenuTargets();" +
@@ -178,7 +241,8 @@ public class ClientTransform implements Transform {
" boolean[] arrbl = this.getMenuForceLeftClick();" +
" net.runelite.api.MenuEntry[] arrmenuEntry = new net.runelite.api.MenuEntry[n2];" +
" int n3 = 0;" +
"while (n3 < n2) {"+
" while (n3 < n2) " +
" {" +
" net.runelite.api.MenuEntry menuEntry = arrmenuEntry[n3] = new net.runelite.api.MenuEntry();" +
" menuEntry.setOption(arrstring[n3]);" +
" menuEntry.setTarget(arrstring2[n3]);" +
@@ -187,18 +251,29 @@ public class ClientTransform implements Transform {
" menuEntry.setParam0(arrn3[n3]);" +
" menuEntry.setParam1(arrn4[n3]);" +
" menuEntry.setForceLeftClick(arrbl[n3]);" +
"++n3; }"+
"return arrmenuEntry; }", ct);
" ++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) {" +
"public void setMenuEntries(net.runelite.api.MenuEntry[] arrmenuEntry)" +
"{" +
" int n2 = 0;" +
" String[] arrstring = this.getMenuOptions();" +
" String[] arrstring2 = this.getMenuTargets();" +
@@ -210,9 +285,11 @@ public class ClientTransform implements Transform {
" net.runelite.api.MenuEntry[] arrmenuEntry2 = arrmenuEntry;" +
" int n3 = arrmenuEntry2.length;" +
" int n4 = 0;" +
"do {" +
" do" +
" {" +
" String string;" +
"if (n4 >= n3) {" +
" if (n4 >= n3)" +
" {" +
" this.setMenuOptionCount(n2);" +
" oldMenuEntryCount = n2;" +
" return;" +
@@ -242,7 +319,8 @@ public class ClientTransform implements Transform {
ct.removeMethod(onMenuOptionsChanged);
onMenuOptionsChanged = CtMethod.make(
"public static void onMenuOptionsChanged(int n2) {"+
"public static void onMenuOptionsChanged(int n2)" +
"{" +
" int n3;" +
" int n4 = oldMenuEntryCount;" +
" oldMenuEntryCount = n3 = " + ByteCodePatcher.clientInstance + ".getMenuOptionCount();" +
@@ -259,6 +337,13 @@ public class ClientTransform implements Transform {
, ct);
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,7 +377,8 @@ public class ClientTransform implements Transform {
ct.removeMethod(draw2010Menu);
draw2010Menu = CtNewMethod.make(
"public void draw2010Menu() {" +
"public void draw2010Menu()" +
"{" +
" int n2 = this.getMenuX();" +
" int n3 = this.getMenuY();" +
" int n4 = this.getMenuWidth();" +
@@ -317,19 +410,31 @@ public class ClientTransform implements Transform {
" int n8 = this.getMenuOptionCount();" +
" String[] arrstring = this.getMenuTargets();" +
" String[] arrstring2 = this.getMenuOptions();" +
"for (int i = 0; i < n8; ++i) {" +
" for (int i = 0; i < n8; ++i)" +
" {" +
" int n9 = n3 + (n8 - 1 - i) * 15 + 31;" +
" String string = arrstring2[i];" +
"if (!arrstring[i].isEmpty()) {" +
" 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;" +
" 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,7 +443,8 @@ public class ClientTransform implements Transform {
CtMethod boundingboxCheck2;
boundingboxCheck2 = CtMethod.make(
"public boolean boundingboxCheck2(net.runelite.api.Model model, int n2, int n3, int n4) {" +
"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];" +
@@ -383,25 +489,40 @@ public class ClientTransform implements Transform {
" int n38 = n35 - n29;" +
" int n39 = n36 - n30;" +
" int n40 = n37 - n31;" +
"if (Math.abs(n38) > n32 + n26) {" +
" if (Math.abs(n38) > n32 + n26)" +
" {" +
" return false;" +
" }" +
"if (Math.abs(n39) > n33 + n27) {" +
" if (Math.abs(n39) > n33 + n27)" +
" {" +
" return false;" +
" }" +
"if (Math.abs(n40) > n34 + n28) {" +
" if (Math.abs(n40) > n34 + n28)" +
" {" +
" return false;" +
" }" +
"if (Math.abs(n40 * n24 - n39 * n25) > n33 * n28 + n34 * n27) {" +
" if (Math.abs(n40 * n24 - n39 * n25) > n33 * n28 + n34 * n27)" +
" {" +
" return false;" +
" }" +
"if (Math.abs(n38 * n25 - n40 * n23) > n34 * n26 + n32 * n28) {" +
" 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;" +
" 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
@@ -421,13 +542,21 @@ public class ClientTransform implements Transform {
" 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) {" +
" if (!bl2)" +
" {" +
" return;" +
" }" +
"if (rSModel.isClickable()) {" +
" 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;" +
" }" +
@@ -445,15 +574,18 @@ public class ClientTransform implements Transform {
" int n19 = " + ByteCodePatcher.clientInstance + ".getCenterY();" +
" int n20 = 0;" +
" int n21 = 0;" +
"if (n2 != 0) {" +
" if (n2 != 0)" +
" {" +
" n20 = net.runelite.api.Perspective.SINE[n2];" +
" n21 = net.runelite.api.Perspective.COSINE[n2];" +
" }" +
"for (n14 = 0; n14 < n15; ++n14) {" +
" for (n14 = 0; n14 < n15; ++n14)" +
" {" +
" n11 = arrn[n14];" +
" n13 = arrn2[n14];" +
" n12 = arrn3[n14];" +
"if (n2 != 0) {" +
" if (n2 != 0)" +
" {" +
" n10 = n12 * n20 + n11 * n21 >> 16;" +
" n12 = n12 * n21 - n11 * n20 >> 16;" +
" n11 = n10;" +
@@ -462,7 +594,8 @@ public class ClientTransform implements Transform {
" n12 = n6 * n12 - n11 * n5 >> 16;" +
" n11 = n10;" +
" n10 = n4 * (n13 += n8) - n12 * n3 >> 16;" +
"if ((n12 = n13 * n3 + n4 * n12 >> 16) >= 50) {" +
" 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;" +
@@ -472,8 +605,10 @@ public class ClientTransform implements Transform {
" n14 = " + ByteCodePatcher.clientInstance + ".getViewportMouseX();" +
" n11 = " + ByteCodePatcher.clientInstance + ".getViewportMouseY();" +
" n13 = 0;" +
"while (n13 < n16) {" +
"if (arrn7[n13] != -2) {" +
" while (n13 < n16)" +
" {" +
" if (arrn7[n13] != -2)" +
" {" +
" int n22;" +
" boolean bl5;" +
" int n23;" +
@@ -486,7 +621,8 @@ public class ClientTransform implements Transform {
" 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)))) {" +
" 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;" +
" }" +
@@ -495,5 +631,12 @@ public class ClientTransform implements Transform {
" }" +
"}", ct);
ct.addMethod(checkClickBox);
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
}

View File

@@ -4,10 +4,13 @@ import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.rs.bytecode.ByteCodePatcher;
@Slf4j
// This prevents the client from sending stack traces to Jagex at all, even classes outside of runelite.
public class ErrorTransform implements Transform {
public class ErrorTransform implements Transform
{
private CtClass ct;
// Where Runelites error interceptor is located, not auto-scraped.
@@ -16,15 +19,17 @@ public class ErrorTransform implements Transform {
// 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);
public void modify(Class clazz)
{
try
{
ct = ByteCodePatcher.classPool.get(ERROR_INSTANCE_CLASS);
transformError();
ByteCodePatcher.modifiedClasses.add(ct);
} catch (CannotCompileException | NotFoundException e) {
}
catch (CannotCompileException | NotFoundException e)
{
e.printStackTrace();
}
}
@@ -35,9 +40,18 @@ public class ErrorTransform implements Transform {
ct.removeMethod(error);
error = CtMethod.make(
"public static void a(String string, Throwable throwable, byte by) {"+
"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);
" 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()
);
}
}

View File

@@ -5,24 +5,32 @@ 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 PlayerTransform implements Transform {
@Slf4j
public class PlayerTransform implements Transform
{
private CtClass ct;
@Override
public void modify(Class player) {
try {
public void modify(Class player)
{
try
{
ct = ByteCodePatcher.classPool.get(player.getName());
transformProtectedGetSkullIcon();
transformGetSkullIcon();
ByteCodePatcher.modifiedClasses.add(ct);
} catch (CannotCompileException | NotFoundException e) {
}
catch (CannotCompileException | NotFoundException e)
{
e.printStackTrace();
}
}
private void transformProtectedGetSkullIcon() throws CannotCompileException, NotFoundException {
private void transformProtectedGetSkullIcon() throws CannotCompileException, NotFoundException
{
CtMethod protectedGetSkullIcon;
protectedGetSkullIcon = ct.getDeclaredMethod("1protect$getRsSkullIcon");
@@ -30,6 +38,13 @@ public class PlayerTransform implements Transform {
protectedGetSkullIcon.setName("getRsSkullIcon");
ct.addMethod(protectedGetSkullIcon);
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
private void transformGetSkullIcon() throws CannotCompileException, NotFoundException
@@ -41,23 +56,34 @@ public class PlayerTransform implements Transform {
ct.removeMethod(getSkullIcon);
getSkullIcon = CtNewMethod.make(
"public "+SkullIcon+" getSkullIcon() {" +
"switch (this.getRsSkullIcon()) {" +
"case 0: {" +
"return " + SkullIcon + ".SKULL; }" +
"case 1: {" +
"return " + SkullIcon + ".SKULL_FIGHT_PIT; }" +
"case 8: {" +
"return " + SkullIcon + ".DEAD_MAN_FIVE; }" +
"case 9: {" +
"return " + SkullIcon + ".DEAD_MAN_FOUR; }" +
"case 10: {" +
"return " + SkullIcon + ".DEAD_MAN_THREE; }" +
"case 11: {" +
"return " + SkullIcon + ".DEAD_MAN_TWO; }" +
"case 12: {" +
"return " + SkullIcon + ".DEAD_MAN_ONE; } }" +
"return null; }", ct);
"public " + SkullIcon + " getSkullIcon()" +
"{" +
"switch (this.getRsSkullIcon())" +
"{" +
"case 0:" +
"return " + SkullIcon + ".SKULL;" +
"case 1:" +
"return " + SkullIcon + ".SKULL_FIGHT_PIT;" +
"case 8:" +
"return " + SkullIcon + ".DEAD_MAN_FIVE;" +
"case 9:" +
"return " + SkullIcon + ".DEAD_MAN_FOUR;" +
"case 10:" +
"return " + SkullIcon + ".DEAD_MAN_THREE;" +
"case 11:" +
"return " + SkullIcon + ".DEAD_MAN_TWO;" +
"case 12:" +
"return " + SkullIcon + ".DEAD_MAN_ONE;" +
"}" +
"return null;" +
"}", ct);
ct.addMethod(getSkullIcon);
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
}

View File

@@ -5,27 +5,29 @@ 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 ProjectileTransform implements Transform {
@Slf4j
public class ProjectileTransform implements Transform
{
private CtClass ct;
// Next variable is manually added, and will break on rev update
private static final String interactingIntvalue = "-1655053057";
@Override
public void modify(Class projectile) {
public void modify(Class projectile)
{
try
{
ct = ByteCodePatcher.classPool.get(projectile.getName());
transformGetAnimation();
transformInteracting();
ByteCodePatcher.modifiedClasses.add(ct);
}
catch (CannotCompileException | NotFoundException e) {
catch (CannotCompileException | NotFoundException e)
{
e.printStackTrace();
}
}
@@ -38,15 +40,24 @@ public class ProjectileTransform implements Transform {
ct.removeMethod(getAnimation);
getAnimation = CtNewMethod.make(
"public void projectileMoved(int n, int n2, int n3, int n4) { " +
"public void projectileMoved(int n, int n2, int n3, int n4)" +
"{ " +
" int n5 = this.getId();" +
" net.runelite.api.coords.LocalPoint localPoint = new net.runelite.api.coords.LocalPoint(n, n2);" +
" net.runelite.api.events.ProjectileMoved projectileMoved = new net.runelite.api.events.ProjectileMoved();" +
" projectileMoved.setProjectile(this);" +
" projectileMoved.setPosition(localPoint);" +
" projectileMoved.setZ(n3);" +
ByteCodePatcher.clientInstance + ".getCallbacks().post(projectileMoved); }", ct);
ByteCodePatcher.clientInstance + ".getCallbacks().post(projectileMoved);" +
"}", ct);
ct.addMethod(getAnimation);
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
private void transformInteracting() throws CannotCompileException
@@ -58,23 +69,44 @@ public class ProjectileTransform implements Transform {
ct.addMethod(getRsInteracting);
getInteracting = CtNewMethod.make(
"public net.runelite.api.Actor getInteracting() {" +
"public net.runelite.api.Actor getInteracting()" +
"{" +
" int var1 = this.getRsInteracting();" +
"if (var1 == 0) {" +
" if (var1 == 0)" +
" {" +
" return null;" +
"} else {" +
" }" +
" else" +
" {" +
" int var2;" +
"if (var1 > 0) {" +
" if (var1 > 0)" +
" {" +
" var2 = var1 - 1;" +
" net.runelite.rs.api.RSNPC[] var4 = " + ByteCodePatcher.clientInstance + ".getCachedNPCs();" +
" return var4[var2];" +
"} else {" +
" }" +
" else" +
" {" +
" var2 = -var1 - 1;" +
"if (var2 == " + ByteCodePatcher.clientInstance + ".getLocalInteractingIndex()) {" +
" if (var2 == " + ByteCodePatcher.clientInstance + ".getLocalInteractingIndex())" +
" {" +
" return " + ByteCodePatcher.clientInstance + ".getLocalPlayer();" +
"} else {" +
" }" +
" else" +
" {" +
" net.runelite.rs.api.RSPlayer[] var3 = " + ByteCodePatcher.clientInstance + ".getCachedPlayers();" +
"return var3[var2]; }}}}", ct);
" return var3[var2];" +
" }" +
" }" +
" }" +
"}", ct);
ct.addMethod(getInteracting);
log.info(
"[RuneLitePlus] transformed {} ({}) at class: {}",
this.getClass().getSimpleName(),
new Object(){}.getClass().getEnclosingMethod().getName(),
ct.getName()
);
}
}