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 +}