From 96b531ffaf89f7838d1db11ebed512743c8c5bc1 Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 11 May 2019 13:35:26 -0400 Subject: [PATCH 1/3] Merging All of the Cox Plugins --- .../client/plugins/zcox/CoxConfig.java | 27 ++- .../client/plugins/zcox/CoxOverlay.java | 27 ++- .../client/plugins/zcox/CoxPlugin.java | 191 +++++++++++------- .../plugins/zcox/OlmCrippleTimerOverlay.java | 93 +++++++++ .../plugins/zcox/OlmPrayAgainstOverlay.java | 127 ++++++++++++ .../client/plugins/zcox/PrayAgainst.java | 32 +++ 6 files changed, 412 insertions(+), 85 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmCrippleTimerOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmPrayAgainstOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/zcox/PrayAgainst.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxConfig.java index 4622573112..3d3db3cbb0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxConfig.java @@ -1,9 +1,26 @@ /* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! + * Copyright (c) 2019, xzact + * Copyright (c) 2019, ganom + * 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.zcox; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxOverlay.java index ed37aede04..3c5f3d2cb3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxOverlay.java @@ -1,9 +1,26 @@ /* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! + * Copyright (c) 2019, xzact + * Copyright (c) 2019, ganom + * 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.zcox; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java index 67f9eef711..edf88dc0ae 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java @@ -1,9 +1,26 @@ /* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! + * Copyright (c) 2019, xzact + * Copyright (c) 2019, ganom + * 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.zcox; @@ -12,19 +29,24 @@ import com.google.inject.Provides; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; +import javax.inject.Singleton; import lombok.AccessLevel; import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.GraphicsObject; import net.runelite.api.MessageNode; import net.runelite.api.NPC; import net.runelite.api.NpcID; +import net.runelite.api.Projectile; import net.runelite.api.Varbits; import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; +import net.runelite.api.events.ProjectileMoved; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -41,6 +63,8 @@ import net.runelite.client.ui.overlay.OverlayManager; type = PluginType.PVM ) +@Slf4j +@Singleton public class CoxPlugin extends Plugin { private static final int GAMEOBJECT_ID_PSN = 30032; @@ -57,6 +81,26 @@ public class CoxPlugin extends Plugin private NPC Guard1_NPC; @Getter(AccessLevel.PACKAGE) private NPC Guard2_NPC; + private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily."; + @Inject + private Client client; + @Getter(AccessLevel.PACKAGE) + private boolean HandCripple; + @Getter(AccessLevel.PACKAGE) + private int timer = 45; + @Getter(AccessLevel.PACKAGE) + private NPC hand; + @Inject + private OverlayManager overlayManager; + @Inject + private OlmCrippleTimerOverlay olmCrippleTimerOverlay; + @Setter + @Getter + protected PrayAgainst prayAgainstOlm; + @Getter + protected long lastPrayTime; + @Inject + private OlmPrayAgainstOverlay prayAgainstOverlay; @Getter(AccessLevel.PACKAGE) private boolean runMutta; @@ -120,13 +164,6 @@ public class CoxPlugin extends Plugin @Inject private ChatMessageManager chatMessageManager; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - @Inject private CoxOverlay overlay; @@ -143,12 +180,19 @@ public class CoxPlugin extends Plugin protected void startUp() { overlayManager.add(overlay); + overlayManager.add(olmCrippleTimerOverlay); + overlayManager.add(prayAgainstOverlay); } @Override protected void shutDown() { overlayManager.remove(overlay); + overlayManager.remove(olmCrippleTimerOverlay); + overlayManager.remove(prayAgainstOverlay); + HandCripple = false; + timer = 45; + hand = null; } @@ -195,6 +239,47 @@ public class CoxPlugin extends Plugin needOlm = true; Olm_NextSpec = -1; } + if (messageNode.getValue().startsWith(OLM_HAND_CRIPPLE)) + { + HandCripple = true; + timer = 45; + } + if (messageNode.getValue().toLowerCase().contains("aggression")) + { + log.debug("Melee Detected"); + prayAgainstOlm = PrayAgainst.MELEE; + lastPrayTime = System.currentTimeMillis(); + } + if (messageNode.getValue().toLowerCase().contains("of magical power")) + { + log.debug("Mage Detected"); + prayAgainstOlm = PrayAgainst.MAGIC; + lastPrayTime = System.currentTimeMillis(); + } + if (messageNode.getValue().toLowerCase().contains("accuracy and dexterity")) + { + log.debug("Missile Detected"); + prayAgainstOlm = PrayAgainst.RANGED; + lastPrayTime = System.currentTimeMillis(); + } + } + + @Subscribe + public void onProjectileMoved(ProjectileMoved event) + { + Projectile projectile = event.getProjectile(); + if (projectile.getId() == 1339) + { + log.debug("Mage Detected"); + prayAgainstOlm = PrayAgainst.MAGIC; + lastPrayTime = System.currentTimeMillis(); + } + if (projectile.getId() == 1340) + { + log.debug("Range Detected"); + prayAgainstOlm = PrayAgainst.RANGED; + lastPrayTime = System.currentTimeMillis(); + } } @Subscribe @@ -212,8 +297,7 @@ public class CoxPlugin extends Plugin runTekton = true; Tekton_NPC = npc; break; - - case NpcID.MUTTADILE://momadile resting + case NpcID.MUTTADILE: Momma_NPC = npc; break; case NpcID.MUTTADILE_7562: @@ -224,28 +308,6 @@ public class CoxPlugin extends Plugin runMutta = true; Momma_NPC = npc; break; - - // case NpcID.GREAT_OLM_7554: - // System.out.println("Found Olm NPC"); - // if (!runOlm) - // { - // Olm_ActionCycle = 4; - /// Olm_TicksUntilAction = 4; - // } else { - // Olm_ActionCycle = 4; - // Olm_TicksUntilAction = 3; - //// } - // OlmPhase++; - // System.out.println("OLM PHASE:"+OlmPhase); - // runOlm = true; - // Olm_NPC = npc; - // Olm_NextSpec = 1; - // break; -// - // case NpcID.GREAT_OLM_LEFT_CLAW: - // case NpcID.GREAT_OLM_LEFT_CLAW_7555: - // OlmMelee_NPC = npc; - // break; case NpcID.GUARDIAN: Guard1_NPC = npc; guardTick = -1; @@ -256,8 +318,10 @@ public class CoxPlugin extends Plugin guardTick = -1; runGuard = true; break; - - //add vanguards + case NpcID.GREAT_OLM_RIGHT_CLAW_7553: + case NpcID.GREAT_OLM_LEFT_CLAW: + hand = npc; + break; } } @@ -276,28 +340,16 @@ public class CoxPlugin extends Plugin runTekton = false; Tekton_NPC = null; break; - case NpcID.MUTTADILE: Momma_NPC = null; break; case NpcID.MUTTADILE_7562: Mutta_NPC = null; break; - case NpcID.MUTTADILE_7563: runMutta = false; Momma_NPC = null; break; - - // case NpcID.GREAT_OLM_7554: - // Olm_NPC = null; - // break; - - //case NpcID.GREAT_OLM_LEFT_CLAW: - // case NpcID.GREAT_OLM_LEFT_CLAW_7555: - // OlmMelee_NPC = null; - // break; -// case NpcID.GUARDIAN: Guard1_NPC = null; runGuard = false; @@ -314,7 +366,10 @@ public class CoxPlugin extends Plugin runGuard = false; Guard2_NPC = null; break; - //add vanguards + case NpcID.GREAT_OLM_RIGHT_CLAW_7553: + case NpcID.GREAT_OLM_LEFT_CLAW: + HandCripple = false; + break; } } @@ -338,6 +393,16 @@ public class CoxPlugin extends Plugin { } + + if (HandCripple) + { + timer--; + if (timer <= 0) + { + HandCripple = false; + timer = 45; + } + } if (needOlm = true) { for (NPC monster : client.getNpcs()) @@ -435,30 +500,6 @@ public class CoxPlugin extends Plugin Olm_TicksUntilAction--; } - //for (GameObject i : client.getGameObjects()) { - // if (i.getId() == GRAPHICSOBJECT_ID_CRYSTAL) { - // WorldPoint newloc; - // for (int x = -1; x <= 1; x++) { - // for (int y = -1; y <= 1; y++) { - // newloc = WorldPoint.fromLocal(client, o.getLocation()); - - // if (config.LargeCrystals()) { - // newloc = newloc.dx(x); - // newloc = newloc.dy(y); - // } - // Olm_Crystals.add(newloc); - // } - - // } - -// - // } - // if (o.getId() == GRAPHICSOBJECT_ID_HEAL) { - // Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation())); - // } - //} - - for (GraphicsObject o : client.getGraphicsObjects()) { if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmCrippleTimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmCrippleTimerOverlay.java new file mode 100644 index 0000000000..e6eeafb62b --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmCrippleTimerOverlay.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2019, ganom + * 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.zcox; + + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics2D; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.NPC; +import net.runelite.api.Point; +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; + + +public class OlmCrippleTimerOverlay extends Overlay +{ + + + private final Client client; + private final CoxPlugin plugin; + + @Inject + private OlmCrippleTimerOverlay(Client client, CoxPlugin plugin) + { + this.client = client; + this.plugin = plugin; + setPosition(OverlayPosition.DYNAMIC); + setPriority(OverlayPriority.HIGH); + setLayer(OverlayLayer.ABOVE_SCENE); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (plugin.isHandCripple()) + { + int tick = plugin.getTimer(); + NPC olmHand = plugin.getHand(); + final String tickStr = String.valueOf(tick); + Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); + renderTextLocation(graphics, tickStr, 12, Font.BOLD, Color.GRAY, canvasPoint); + } + + + return null; + } + + private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) + { + graphics.setFont(new Font("Arial", fontStyle, fontSize)); + if (canvasPoint != null) + { + final Point canvasCenterPoint = new Point( + canvasPoint.getX(), + canvasPoint.getY()); + final Point canvasCenterPoint_shadow = new Point( + canvasPoint.getX() + 1, + canvasPoint.getY() + 1); + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); + } + } + +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmPrayAgainstOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmPrayAgainstOverlay.java new file mode 100644 index 0000000000..497bf03d78 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/OlmPrayAgainstOverlay.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2019, gazivodag + * Copyright (c) 2019, ganom + * 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.zcox; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.SpriteID; +import net.runelite.client.game.SpriteManager; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.components.InfoBoxComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; + +class OlmPrayAgainstOverlay extends Overlay +{ + + private final CoxPlugin plugin; + private final Client client; + private final SpriteManager spriteManager; + private final PanelComponent panelComponent = new PanelComponent(); + + @Inject + OlmPrayAgainstOverlay(CoxPlugin plugin, Client client, SpriteManager spriteManager) + { + this.plugin = plugin; + this.client = client; + this.spriteManager = spriteManager; + setPosition(OverlayPosition.BOTTOM_RIGHT); + panelComponent.setOrientation(PanelComponent.Orientation.VERTICAL); + } + + public Dimension render(Graphics2D graphics2D) + { + if (plugin.getPrayAgainstOlm() == null) + { + return null; + } + + panelComponent.getChildren().clear(); + + if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000)) + { + InfoBoxComponent prayComponent = new InfoBoxComponent(); + Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm)); + prayComponent.setImage(prayImg); + prayComponent.setColor(Color.WHITE); + prayComponent.setPreferredSize(new Dimension(40, 40)); + panelComponent.getChildren().add(prayComponent); + + panelComponent.setPreferredSize(new Dimension(40, 40)); + panelComponent.setBorder(new Rectangle(0, 0, 0, 0)); + return panelComponent.render(graphics2D); + } + else + { + plugin.setPrayAgainstOlm(null); + } + + return null; + } + + private BufferedImage getPrayerImage(PrayAgainst prayAgainst) + { + switch (prayAgainst) + { + case MAGIC: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); + case MELEE: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); + case RANGED: + return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); + } + return null; + } + + private Image scaleImg(final Image img) + { + if (img == null) + { + return null; + } + final double width = img.getWidth(null); + final double height = img.getHeight(null); + final double size = 36; // Limit size to 2 as that is minimum size not causing breakage + final double scalex = size / width; + final double scaley = size / height; + final double scale = Math.min(scalex, scaley); + final int newWidth = (int) (width * scale); + final int newHeight = (int) (height * scale); + final BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); + final Graphics g = scaledImage.createGraphics(); + g.drawImage(img, 0, 0, newWidth, newHeight, null); + g.dispose(); + return scaledImage; + } + + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/PrayAgainst.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/PrayAgainst.java new file mode 100644 index 0000000000..ec9503a074 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/PrayAgainst.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019, gazivodag + * Copyright (c) 2019, ganom + * 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.zcox; + +enum PrayAgainst +{ + MELEE, + MAGIC, + RANGED +} From 8c517c9b730786a18ab9c8baff418e781400656c Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 11 May 2019 13:36:35 -0400 Subject: [PATCH 2/3] Fixing license --- .../main/java/net/runelite/client/plugins/zcox/CoxPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java index edf88dc0ae..477acadb43 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zcox/CoxPlugin.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2019, xzact + * Copyright (c) 2019, gazivodag * Copyright (c) 2019, ganom * All rights reserved. * From 2bfe724353a2fc078925d5b8fd54301506368a34 Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 11 May 2019 13:37:47 -0400 Subject: [PATCH 3/3] Removing Merged plugins --- .../OlmCrippleTimerOverlay.java | 89 ------------ .../OlmCrippleTimerPlugin.java | 114 ---------------- .../olmprayagainst/OlmPrayAgainstOverlay.java | 110 --------------- .../olmprayagainst/OlmPrayAgainstPlugin.java | 127 ------------------ .../plugins/olmprayagainst/PrayAgainst.java | 30 ----- 5 files changed, 470 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerPlugin.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstPlugin.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/PrayAgainst.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerOverlay.java deleted file mode 100644 index c6e52bd5dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerOverlay.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * 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.olmcrippletimer; - - -import java.awt.*; -import java.util.*; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.*; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -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; - - -public class OlmCrippleTimerOverlay extends Overlay { - - - private final Client client; - private final OlmCrippleTimerPlugin plugin; - - @Inject - private OlmCrippleTimerOverlay(Client client, OlmCrippleTimerPlugin plugin){ - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) { - if(plugin.isHandCripple()){ - int tick = plugin.getTimer(); - NPC olmHand = plugin.getHand(); - final String tickStr = String.valueOf(tick); - Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); - renderTextLocation(graphics, tickStr, 12 , Font.BOLD, Color.GRAY, canvasPoint); - } - - - return null; - } - //this is just copy pasted btw - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1) ; - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerPlugin.java deleted file mode 100644 index 3946d21645..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/olmcrippletimer/OlmCrippleTimerPlugin.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * 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.olmcrippletimer; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -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; - -@PluginDescriptor( - name="Olm Cripple Timer", - description = "Shows a timer over the olm hand cripple", - tags = {"cox", "raid", "clench", "melee", "hand"}, - type = PluginType.PVM -) - -public class OlmCrippleTimerPlugin extends Plugin{ - - private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily."; - @Inject - private Client client; - @Getter(AccessLevel.PACKAGE) - private boolean HandCripple; - @Getter(AccessLevel.PACKAGE) - private int timer = 45; - @Getter(AccessLevel.PACKAGE) - private NPC hand; - @Inject - private OverlayManager overlayManager; - @Inject - private OlmCrippleTimerOverlay olmCrippleTimerOverlay; - - @Override - protected void startUp() throws Exception { - overlayManager.add(olmCrippleTimerOverlay); - } - @Override - protected void shutDown() throws Exception { - overlayManager.remove(olmCrippleTimerOverlay); - HandCripple = false; - timer = 45; - hand = null; - - } - @Subscribe - public void onChatMessage(ChatMessage event) - { - - String message = event.getMessage(); - if(message.startsWith(OLM_HAND_CRIPPLE)){ - HandCripple = true; - timer = 45; - } - } - @Subscribe - public void onNpcDespawned(NpcDespawned npcdespawned){ - if(npcdespawned.getNpc().getId() == NpcID.GREAT_OLM_RIGHT_CLAW_7553 || npcdespawned.getNpc().getId() == NpcID.GREAT_OLM_RIGHT_CLAW){ - HandCripple = false; - } - } - @Subscribe - public void onNpcSpawned(NpcSpawned npcSpawned) - { - if(npcSpawned.getNpc().getId() == NpcID.GREAT_OLM_LEFT_CLAW_7555 || npcSpawned.getNpc().getId() == NpcID.GREAT_OLM_LEFT_CLAW){ - hand = npcSpawned.getNpc(); - } - } - @Subscribe - public void onGameTick(GameTick event) - { - if(HandCripple) { - timer--; - if (timer <= 0) { - HandCripple = false; - timer = 45; - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstOverlay.java deleted file mode 100644 index ba93a8f90a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstOverlay.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2019, gazivodag - * 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.olmprayagainst; - -import net.runelite.api.Client; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.InfoBoxComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -import javax.inject.Inject; -import java.awt.*; -import java.awt.image.BufferedImage; - -class OlmPrayAgainstOverlay extends Overlay { - - private final OlmPrayAgainstPlugin plugin; - private final Client client; - private final SpriteManager spriteManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - OlmPrayAgainstOverlay(OlmPrayAgainstPlugin plugin, Client client, SpriteManager spriteManager) { - this.plugin = plugin; - this.client = client; - this.spriteManager = spriteManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(PanelComponent.Orientation.VERTICAL); - } - - public Dimension render(Graphics2D graphics2D) { - if (plugin.getPrayAgainstOlm() == null) return null; - - panelComponent.getChildren().clear(); - - if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000)) { - InfoBoxComponent prayComponent = new InfoBoxComponent(); - Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm)); - prayComponent.setImage(prayImg); - prayComponent.setColor(Color.WHITE); - prayComponent.setPreferredSize(new Dimension(40,40)); - panelComponent.getChildren().add(prayComponent); - - panelComponent.setPreferredSize(new Dimension(40,40)); - panelComponent.setBorder(new Rectangle(0,0,0,0)); - return panelComponent.render(graphics2D); - } else { - plugin.setPrayAgainstOlm(null); - } - - return null; - } - - private BufferedImage getPrayerImage(PrayAgainst prayAgainst) { - switch (prayAgainst) { - case MAGIC: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - case MELEE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); - case RANGED: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - } - return null; - } - - private Image scaleImg(final Image img) { - if (img == null) - { - return null; - } - final double width = img.getWidth(null); - final double height = img.getHeight(null); - final double size = 36; // Limit size to 2 as that is minimum size not causing breakage - final double scalex = size / width; - final double scaley = size / height; - final double scale = Math.min(scalex, scaley); - final int newWidth = (int) (width * scale); - final int newHeight = (int) (height * scale); - final BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); - final Graphics g = scaledImage.createGraphics(); - g.drawImage(img, 0, 0, newWidth, newHeight, null); - g.dispose(); - return scaledImage; - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstPlugin.java deleted file mode 100644 index b313f817df..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/OlmPrayAgainstPlugin.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, gazivodag - * 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.olmprayagainst; - -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.Projectile; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.ProjectileMoved; -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; - -/* - * Tells you what to pray against Olm (Not to be confused with ganoms swapper) - * Most of the code is from Haha Kut's Alchemical Hydra plugin. (See OlmPrayAgainstOverlay) - */ - -@PluginDescriptor( - name = "Olm Pray Against", - description = "Tells you what to pray against Olm", - tags = {"prayer", "olm", "raids", "pray against", "cox"}, - type = PluginType.PVM -) -@Slf4j -@Singleton -public class OlmPrayAgainstPlugin extends Plugin -{ - @Setter - @Getter - protected PrayAgainst prayAgainstOlm; - @Getter - protected long lastPrayTime; - @Inject - private Client client; - @Inject - private OlmPrayAgainstOverlay overlay; - @Inject - private OverlayManager overlayManager; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() throws Exception - { - overlayManager.remove(overlay); - } - - @Subscribe - public void onChatMessage(ChatMessage event) - { - final String msg = event.getMessage(); - if (event.getType() == ChatMessageType.GAMEMESSAGE) - { - if (msg.toLowerCase().contains("aggression")) - { - log.debug("Melee Detected"); - prayAgainstOlm = PrayAgainst.MELEE; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.toLowerCase().contains("of magical power")) - { - log.debug("Mage Detected"); - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.toLowerCase().contains("accuracy and dexterity")) - { - log.debug("Missile Detected"); - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - } - } - } - - @Subscribe - public void onProjectileMoved(ProjectileMoved event) - { - Projectile projectile = event.getProjectile(); - if (projectile.getId() == 1339) - { - log.debug("Mage Detected"); - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - } - if (projectile.getId() == 1340) - { - log.debug("Range Detected"); - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/PrayAgainst.java b/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/PrayAgainst.java deleted file mode 100644 index 8e9360bdef..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/olmprayagainst/PrayAgainst.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2019, gazivodag - * 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.olmprayagainst; - -enum PrayAgainst { - MELEE, - MAGIC, - RANGED -}