From 8e544e2ec1d4924b04ae036a6a938e5b7c584c46 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sun, 5 May 2019 22:01:12 +0100 Subject: [PATCH 1/2] Add Chambers of Xeric shortcut overlays Add Chambers of Xeric shortcut overlays --- .../raids/shortcuts/ShortcutConfig.java | 17 +++ .../raids/shortcuts/ShortcutOverlay.java | 116 ++++++++++++++++++ .../raids/shortcuts/ShortcutPlugin.java | 103 ++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java new file mode 100644 index 0000000000..857afd3a4d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java @@ -0,0 +1,17 @@ +package net.runelite.client.plugins.raids.shortcuts; + +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("shortcut") +public interface ShortcutConfig { + @ConfigItem( + keyName = "highlightShortcuts", + name = "Highlight shortcuts", + description = "Displays which shortcut it is" + ) + default boolean highlightShortcuts() + { + return true; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java new file mode 100644 index 0000000000..c23c99521f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java @@ -0,0 +1,116 @@ +package net.runelite.client.plugins.raids.shortcuts; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Polygon; +import java.awt.image.BufferedImage; + +import javax.inject.Inject; + +import net.runelite.api.Client; +import net.runelite.api.GameObject; +import net.runelite.api.Perspective; +import net.runelite.api.Point; +import net.runelite.api.Skill; +import net.runelite.api.TileObject; +import net.runelite.client.game.SkillIconManager; +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; + +public class ShortcutOverlay extends Overlay +{ + private final Client client; + private final ShortcutConfig config; + private final ShortcutPlugin plugin; + private final BufferedImage treeIcon; + private final BufferedImage strengthIcon; + private final BufferedImage miningIcon; + + @Inject + ShortcutOverlay(Client client, ShortcutConfig config, ShortcutPlugin plugin, SkillIconManager iconManager) + { + this.client = client; + this.config = config; + this.plugin = plugin; + setPosition(OverlayPosition.DYNAMIC); + setPriority(OverlayPriority.LOW); + setLayer(OverlayLayer.ABOVE_SCENE); + + treeIcon = iconManager.getSkillImage(Skill.WOODCUTTING); + strengthIcon = iconManager.getSkillImage(Skill.STRENGTH); + miningIcon = iconManager.getSkillImage(Skill.MINING); + } + + @Override + public Dimension render(Graphics2D graphics) + { + for (TileObject shortcut : plugin.getShortcut()) + { + if (shortcut.getPlane() == client.getPlane()) + { + Polygon poly; + if ((shortcut instanceof GameObject)) + { + poly = ((GameObject) shortcut).getConvexHull(); + } + else + { + poly = shortcut.getCanvasTilePoly(); + } + if (poly != null) + { + String name; + switch (shortcut.getId()) + { + case 29736: + name = "Tree"; + break; + case 29738: + name = "Rocks"; + break; + case 297480: + name = "Boulder"; + break; + case 29737: + case 29739: + default: + name = "null"; + } + if (config.highlightShortcuts()) + { + if (name.equals("Tree")) + { + Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), + treeIcon, 150); + if (canvasLoc != null) + { + graphics.drawImage(treeIcon, canvasLoc.getX(), canvasLoc.getY(), null); + } + } + if (name.equals("Rocks")) + { + Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), + miningIcon, 150); + if (canvasLoc != null) + { + graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null); + } + } + if (name.equals("Boulder")) + { + Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), + strengthIcon, 150); + if (canvasLoc != null) + { + graphics.drawImage(strengthIcon, canvasLoc.getX(), canvasLoc.getY(), null); + } + } + } + } + } + } + return null; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java new file mode 100644 index 0000000000..30fb3b2e42 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java @@ -0,0 +1,103 @@ +package net.runelite.client.plugins.raids.shortcuts; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.inject.Inject; + +import com.google.inject.Provides; + +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.TileObject; +import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.GameObjectDespawned; +import net.runelite.api.events.GameObjectSpawned; +import net.runelite.api.events.GameTick; +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.OverlayManager; + +@PluginDescriptor( + name = "Raid Shortcuts", + description = "Highlights Raid Shortcuts", + tags = {"boulder", "cox", "raids", "highlight"} +) +@Slf4j +public class ShortcutPlugin extends Plugin +{ + @Inject + private Client client; + + @Inject + private OverlayManager overlayManager; + + @Inject + private ShortcutOverlay overlay; + + private final List shortcut = new ArrayList<>(); + + List getShortcut() + { + return shortcut; + } + + @Provides + ShortcutConfig provideConfig(ConfigManager configManager) + { + return (ShortcutConfig)configManager.getConfig(ShortcutConfig.class); + } + + @Override + protected void startUp() + { + overlayManager.add(overlay); + } + + @Override + protected void shutDown() + { + overlayManager.remove(overlay); + } + + @Subscribe + public void onGameObjectSpawned(GameObjectSpawned event) + { + WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, event.getGameObject().getLocalLocation()); + if (worldPoint == null) + { + return; + } + if ((event.getGameObject().getId() == 29740) || (event.getGameObject().getId() == 29736) || (event.getGameObject().getId() == 29738)) + { + shortcut.add(event.getGameObject()); + } + } + + @Subscribe + public void onGameObjectDespawned(GameObjectDespawned event) + { + shortcut.remove(event.getGameObject()); + } + + @Subscribe + public void onGameTick(GameTick tick) + { + if (shortcut == null) + { + return; + } + Iterator it = shortcut.iterator(); + while (it.hasNext()) + { + TileObject object = (TileObject)it.next(); + if (object.getCanvasLocation() == null) + { + it.remove(); + } + } + } +} From 0827e321fdb7b408694b7379c53011a2e7537f96 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sun, 5 May 2019 22:01:56 +0100 Subject: [PATCH 2/2] Add files via upload --- .../runelite/client/plugins/config/star_on.png | Bin 349 -> 483 bytes .../client/plugins/config/switcher_on.png | Bin 368 -> 425 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/config/star_on.png b/runelite-client/src/main/resources/net/runelite/client/plugins/config/star_on.png index e2453abf2599f4e4d965f4ee420f4e3ced964e5b..966e5fab4c098d9422db44a5814162b42ca8350b 100644 GIT binary patch delta 458 zcmV;*0X6>J0^;kE?R0) z)4;&+Ka=r4!+!<_264Qx`JdtSe|~n{*iino`I1;oq%EQSU7)ahaKpC0aJ$&*c+|Oc)$E*Il%az z(FliO*Z;Hr^?!*z(s2)K7$FNTv#hFQ_{Z3W!=R3+ldYBLa#*8(xq0=9{|pS_*bVxB zIO=4Z9Z?1?Gp|0+z`$St4aEEZ85n*rFfeF>HUDS)^!e{Ak@T~(e&hApI=yl1gz|in-nMHLO!+(ZG1_lNW#{W!qk*Asu<3lxQg-M;~UzWdF|5^W)#~g0I zhOBt5b(s|BUzYy=f0?&OpKe}2FtCYDM>H`A0R9Gw6P`6-X8-^I07*qoM6N<$f|Ok2 AS^xk5 delta 323 zcmV-J0lfa>1Kk3UBYyx1a7bBm000XU000XU0RWnu7ytkP4@pEpR5*>*)4whRQ547V z58)=O5RIKqLn6V3L^hF#C-4%QDR=>mLP5a;Xyy$zRwD5d8cLmQO(Yrxra&=6_Me%J ziqqVCPk#BH-#I6je-~L2ZDmQcU8S2Cfpvy?OqGeoE8NUr1%I_Hi5kBK;iT(+R3;o7 z;v!%U4Yd0-JGe$C#Od2mP?ki8*u@8;3a5{St{viZkKWcU}7>(Cmf`fC|_%&Pza-Ax`i6lRvG0wFI;|Ecp|tdqy33 zJKsgJB$})QWjsk#$6E0`#zKhGCG6uB)7Tir(K@c=TR8}E`VJvZPvw8ERh)l3J^>}2 VKAY0l@xlNA002ovPDHLkV1g4PiSPgb diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/config/switcher_on.png b/runelite-client/src/main/resources/net/runelite/client/plugins/config/switcher_on.png index e49f318005b6aa9edc3184ccd3a903fee76b4d04..19b4bb64fb0560077b8472a049e793fa04d29d51 100644 GIT binary patch delta 400 zcmV;B0dM~B0;vO#BYy#KNkl8MIrjHb%w-Rk7b@*etsCieuBf56T$~4292eT0&e2 z(5G$3@GRCw=8HE!$6r;Do{vA6Zy$QXv-Jpr)M5sPqN_Ob32_#{RCP)*FtDmJF#HyT uh_JqAU|_t3>;npYLYi~PF1tvv1^|$!auD>wKbHUi00{s|MNUMnLSTX)-NcIk delta 342 zcmV-c0jd6}1MmWnBYyx1a7bBm000XU000XU0RWnu7ytkPB1uF+R5*>@)4xl@Kor37 zZ<0oeP{l<`rw*wZ1jWHYoSj5;5*K&Z4&LH_5W!hob#WD)Toge>w}QgifQUk^LZx-E z7(!ek)ZpbxT*SA%ANM{S$H9LIBkMumV*#iF({bqv*m4AiT7Sg%C;*c{5wI1;GO(oR zZ8`#>M0}4SU=A2i-+?J$J*5w@;t2M?5;M`9&;SIXv8VwELSv&hPa;L#0?Ulbeawud zA=-$dzQ(>iLlSw?o$hqarf#PFZat!tcA5VBErS0BYrqAfQ?)ciw^XhE*ZGJc(Rsh;vtA2J@ING@w-IY>a{~C#* o5>Np~;?gT{E2V5?-TC+96In+a07*qoM6N<$g1XX~O#lD@