runelite-client: remove Zulrah plugin

It has been deemed to be against the game rules, and removal requested by Jagex.
This commit is contained in:
Adam
2018-01-25 11:24:04 -05:00
parent 050fbd250b
commit 155dfb7c63
17 changed files with 0 additions and 1635 deletions

View File

@@ -1,47 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "zulrah",
name = "Zulrah",
description = "Configuration for the zulrah plugin"
)
public interface ZulrahConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enabled",
description = "Configures whether or not zulrah overlays are displayed"
)
default boolean enabled()
{
return true;
}
}

View File

@@ -1,138 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah;
import net.runelite.api.NPC;
import net.runelite.api.Point;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPattern;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public class ZulrahInstance
{
private static final ZulrahPhase NO_PATTERN_MAGIC_PHASE = new ZulrahPhase(
ZulrahLocation.NORTH,
ZulrahType.MAGIC,
false,
StandLocation.PILLAR_WEST_OUTSIDE,
Prayer.PROTECT_FROM_MAGIC
);
private static final ZulrahPhase NO_PATTERN_RANGE_PHASE = new ZulrahPhase(
ZulrahLocation.NORTH,
ZulrahType.RANGE,
false,
StandLocation.TOP_EAST,
Prayer.PROTECT_FROM_MISSILES
);
private static final ZulrahPhase PATTERN_A_OR_B_RANGE_PHASE = new ZulrahPhase(
ZulrahLocation.NORTH,
ZulrahType.RANGE,
false,
StandLocation.PILLAR_WEST_OUTSIDE,
Prayer.PROTECT_FROM_MISSILES
);
private final Point startLocation;
private ZulrahPattern pattern;
private int stage;
private ZulrahPhase phase;
public ZulrahInstance(NPC zulrah)
{
this.startLocation = zulrah.getWorldLocation();
}
public Point getStartLocation()
{
return startLocation;
}
public ZulrahPattern getPattern()
{
return pattern;
}
public void setPattern(ZulrahPattern pattern)
{
this.pattern = pattern;
}
public int getStage()
{
return stage;
}
public void nextStage()
{
++stage;
}
public void reset()
{
pattern = null;
stage = 0;
}
public ZulrahPhase getPhase()
{
ZulrahPhase patternPhase = null;
if (pattern != null)
{
patternPhase = pattern.get(stage);
}
return patternPhase != null ? patternPhase : phase;
}
public void setPhase(ZulrahPhase phase)
{
this.phase = phase;
}
public ZulrahPhase getNextPhase()
{
if (pattern != null)
{
return pattern.get(stage + 1);
}
else if (phase != null)
{
ZulrahType type = phase.getType();
StandLocation standLocation = phase.getStandLocation();
if (type == ZulrahType.MELEE)
{
return standLocation == StandLocation.TOP_EAST ? NO_PATTERN_MAGIC_PHASE : NO_PATTERN_RANGE_PHASE;
}
if (type == ZulrahType.MAGIC)
{
return standLocation == StandLocation.TOP_EAST ? NO_PATTERN_RANGE_PHASE : PATTERN_A_OR_B_RANGE_PHASE;
}
}
return null;
}
}

View File

@@ -1,196 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah;
import com.google.inject.Binder;
import com.google.inject.Provides;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Collection;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.NPC;
import net.runelite.api.Query;
import net.runelite.api.queries.NPCQuery;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.zulrah.overlays.ZulrahCurrentPhaseOverlay;
import net.runelite.client.plugins.zulrah.overlays.ZulrahNextPhaseOverlay;
import net.runelite.client.plugins.zulrah.overlays.ZulrahOverlay;
import net.runelite.client.plugins.zulrah.overlays.ZulrahPrayerOverlay;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPattern;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternA;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternB;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternC;
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternD;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.util.QueryRunner;
@PluginDescriptor(
name = "Zulrah plugin"
)
@Slf4j
public class ZulrahPlugin extends Plugin
{
@Inject
QueryRunner queryRunner;
@Inject
Client client;
@Inject
ZulrahConfig config;
@Inject
ZulrahOverlay overlay;
@Inject
ZulrahCurrentPhaseOverlay currentPhaseOverlay;
@Inject
ZulrahNextPhaseOverlay nextPhaseOverlay;
@Inject
ZulrahPrayerOverlay zulrahPrayerOverlay;
private final ZulrahPattern[] patterns = new ZulrahPattern[]
{
new ZulrahPatternA(),
new ZulrahPatternB(),
new ZulrahPatternC(),
new ZulrahPatternD()
};
private ZulrahInstance instance;
@Override
public void configure(Binder binder)
{
binder.bind(ZulrahOverlay.class);
}
@Provides
ZulrahConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(ZulrahConfig.class);
}
@Override
public Collection<Overlay> getOverlays()
{
return Arrays.asList(overlay, currentPhaseOverlay, nextPhaseOverlay, zulrahPrayerOverlay);
}
@Schedule(
period = 600,
unit = ChronoUnit.MILLIS
)
public void update()
{
if (!config.enabled() || client.getGameState() != GameState.LOGGED_IN)
{
return;
}
NPC zulrah = findZulrah();
if (zulrah == null)
{
if (instance != null)
{
log.debug("Zulrah encounter has ended.");
instance = null;
}
return;
}
if (instance == null)
{
instance = new ZulrahInstance(zulrah);
log.debug("Zulrah encounter has started.");
}
ZulrahPhase currentPhase = ZulrahPhase.valueOf(zulrah, instance.getStartLocation());
if (instance.getPhase() == null)
{
instance.setPhase(currentPhase);
}
else if (!instance.getPhase().equals(currentPhase))
{
ZulrahPhase previousPhase = instance.getPhase();
instance.setPhase(currentPhase);
instance.nextStage();
log.debug("Zulrah phase has moved from {} -> {}, stage: {}", previousPhase, currentPhase, instance.getStage());
}
ZulrahPattern pattern = instance.getPattern();
if (pattern == null)
{
int potential = 0;
ZulrahPattern potentialPattern = null;
for (ZulrahPattern p : patterns)
{
if (p.stageMatches(instance.getStage(), instance.getPhase()))
{
potential++;
potentialPattern = p;
}
}
if (potential == 1)
{
log.debug("Zulrah pattern identified: {}", potentialPattern);
instance.setPattern(potentialPattern);
}
}
else if (pattern.canReset(instance.getStage()) && (instance.getPhase() == null || instance.getPhase().equals(pattern.get(0))))
{
log.debug("Zulrah pattern has reset.");
instance.reset();
}
}
private NPC findZulrah()
{
Query query = new NPCQuery().nameEquals("Zulrah");
NPC[] result = queryRunner.runQuery(query);
return result.length == 1 ? result[0] : null;
}
public ZulrahInstance getInstance()
{
return instance;
}
}

View File

@@ -1,80 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.overlays;
import net.runelite.client.plugins.zulrah.ZulrahInstance;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
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.ImagePanelComponent;
import javax.inject.Inject;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.image.BufferedImage;
public class ZulrahCurrentPhaseOverlay extends Overlay
{
private final ZulrahPlugin plugin;
@Inject
ZulrahCurrentPhaseOverlay(ZulrahPlugin plugin)
{
setPosition(OverlayPosition.BOTTOM_RIGHT);
setPriority(OverlayPriority.HIGH);
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
ZulrahInstance instance = plugin.getInstance();
if (instance == null)
{
return null;
}
ZulrahPhase currentPhase = instance.getPhase();
if (currentPhase == null)
{
return null;
}
String pattern = instance.getPattern() != null ? instance.getPattern().toString() : "Unknown";
String title = currentPhase.isJad() ? "JAD PHASE" : pattern;
Color backgroundColor = currentPhase.getColor();
BufferedImage zulrahImage = ZulrahImageManager.getZulrahBufferedImage(currentPhase.getType());
ImagePanelComponent imagePanelComponent = new ImagePanelComponent();
imagePanelComponent.setTitle(title);
imagePanelComponent.setBackgroundColor(backgroundColor);
imagePanelComponent.setImage(zulrahImage);
return imagePanelComponent.render(graphics, parent);
}
}

View File

@@ -1,130 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.overlays;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
@Slf4j
public class ZulrahImageManager
{
private static final BufferedImage[] zulrahBufferedImages = new BufferedImage[3];
private static final BufferedImage[] smallZulrahBufferedImages = new BufferedImage[3];
private static final BufferedImage[] prayerBufferedImages = new BufferedImage[2];
public static BufferedImage getZulrahBufferedImage(ZulrahType type)
{
switch (type)
{
case RANGE:
if (zulrahBufferedImages[0] == null)
{
zulrahBufferedImages[0] = getBufferedImage("zulrah_range.png");
}
return zulrahBufferedImages[0];
case MAGIC:
if (zulrahBufferedImages[1] == null)
{
zulrahBufferedImages[1] = getBufferedImage("zulrah_magic.png");
}
return zulrahBufferedImages[1];
case MELEE:
if (zulrahBufferedImages[2] == null)
{
zulrahBufferedImages[2] = getBufferedImage("zulrah_melee.png");
}
return zulrahBufferedImages[2];
}
return null;
}
public static BufferedImage getSmallZulrahBufferedImage(ZulrahType type)
{
switch (type)
{
case RANGE:
if (smallZulrahBufferedImages[0] == null)
{
smallZulrahBufferedImages[0] = getBufferedImage("zulrah_range_sm.png");
}
return smallZulrahBufferedImages[0];
case MAGIC:
if (smallZulrahBufferedImages[1] == null)
{
smallZulrahBufferedImages[1] = getBufferedImage("zulrah_magic_sm.png");
}
return smallZulrahBufferedImages[1];
case MELEE:
if (smallZulrahBufferedImages[2] == null)
{
smallZulrahBufferedImages[2] = getBufferedImage("zulrah_melee_sm.png");
}
return smallZulrahBufferedImages[2];
}
return null;
}
public static BufferedImage getProtectionPrayerBufferedImage(Prayer prayer)
{
switch (prayer)
{
case PROTECT_FROM_MAGIC:
if (prayerBufferedImages[0] == null)
{
prayerBufferedImages[0] = getBufferedImage("/prayers/protect_from_magic.png");
}
return prayerBufferedImages[0];
case PROTECT_FROM_MISSILES:
if (prayerBufferedImages[1] == null)
{
prayerBufferedImages[1] = getBufferedImage("/prayers/protect_from_missiles.png");
}
return prayerBufferedImages[1];
}
return null;
}
private static BufferedImage getBufferedImage(String path)
{
BufferedImage image = null;
try
{
InputStream in = ZulrahPlugin.class.getResourceAsStream(path);
image = ImageIO.read(in);
}
catch (IOException e)
{
log.debug("Error loading image {}", e);
}
return image;
}
}

View File

@@ -1,78 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.overlays;
import net.runelite.client.plugins.zulrah.ZulrahInstance;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
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.ImagePanelComponent;
import javax.inject.Inject;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.image.BufferedImage;
public class ZulrahNextPhaseOverlay extends Overlay
{
private final ZulrahPlugin plugin;
@Inject
ZulrahNextPhaseOverlay(ZulrahPlugin plugin)
{
setPosition(OverlayPosition.BOTTOM_RIGHT);
setPriority(OverlayPriority.HIGH);
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
ZulrahInstance instance = plugin.getInstance();
if (instance == null)
{
return null;
}
ZulrahPhase nextPhase = instance.getNextPhase();
if (nextPhase == null)
{
return null;
}
Color backgroundColor = nextPhase.getColor();
BufferedImage zulrahImage = ZulrahImageManager.getSmallZulrahBufferedImage(nextPhase.getType());
ImagePanelComponent imagePanelComponent = new ImagePanelComponent();
imagePanelComponent.setTitle("Next");
imagePanelComponent.setBackgroundColor(backgroundColor);
imagePanelComponent.setImage(zulrahImage);
return imagePanelComponent.render(graphics, parent);
}
}

View File

@@ -1,241 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.overlays;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import javax.annotation.Nullable;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.client.plugins.zulrah.ZulrahInstance;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
@Slf4j
public class ZulrahOverlay extends Overlay
{
private static final Color TILE_BORDER_COLOR = new Color(0, 0, 0, 100);
private static final Color NEXT_TEXT_COLOR = new Color(255, 255, 255, 100);
private final Client client;
private final ZulrahPlugin plugin;
@Inject
ZulrahOverlay(@Nullable Client client, ZulrahPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics, java.awt.Point point)
{
ZulrahInstance instance = plugin.getInstance();
if (instance == null)
{
return null;
}
ZulrahPhase currentPhase = instance.getPhase();
ZulrahPhase nextPhase = instance.getNextPhase();
if (currentPhase == null)
{
return null;
}
Point startTile = instance.getStartLocation();
if (nextPhase != null && currentPhase.getStandLocation() == nextPhase.getStandLocation())
{
drawStandTiles(graphics, startTile, currentPhase, nextPhase);
}
else
{
drawStandTile(graphics, startTile, currentPhase, false);
drawStandTile(graphics, startTile, nextPhase, true);
}
drawZulrahTileMinimap(graphics, startTile, currentPhase, false);
drawZulrahTileMinimap(graphics, startTile, nextPhase, true);
return null;
}
private void drawStandTiles(Graphics2D graphics, Point startTile, ZulrahPhase currentPhase, ZulrahPhase nextPhase)
{
Point localTile = Perspective.worldToLocal(client, currentPhase.getStandTile(startTile));
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
Polygon northPoly = getCanvasTileNorthPoly(client, localTile);
Polygon southPoly = getCanvasTileSouthPoly(client, localTile);
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, "Next", 0);
if (northPoly != null && southPoly != null && poly != null && textLoc != null)
{
Color northColor = currentPhase.getColor();
Color southColor = nextPhase.getColor();
graphics.setColor(northColor);
graphics.fillPolygon(northPoly);
graphics.setColor(southColor);
graphics.fillPolygon(southPoly);
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.setColor(NEXT_TEXT_COLOR);
graphics.drawString("Next", textLoc.getX(), textLoc.getY());
}
if (nextPhase.isJad())
{
Image jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(nextPhase.getPrayer());
if (jadPrayerImg != null)
{
Point imageLoc = Perspective.getCanvasImageLocation(client, graphics, localTile, (BufferedImage) jadPrayerImg, 0);
if (imageLoc != null)
{
graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null);
}
}
}
}
private void drawStandTile(Graphics2D graphics, Point startTile, ZulrahPhase phase, boolean next)
{
if (phase == null)
{
return;
}
Point localTile = Perspective.worldToLocal(client, phase.getStandTile(startTile));
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
Color color = phase.getColor();
if (poly != null)
{
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.setColor(color);
graphics.fillPolygon(poly);
}
if (next)
{
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, "Next", 0);
if (textLoc != null)
{
graphics.setColor(NEXT_TEXT_COLOR);
graphics.drawString("Next", textLoc.getX(), textLoc.getY());
}
if (phase.isJad())
{
Image jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(phase.getPrayer());
if (jadPrayerImg != null)
{
Point imageLoc = Perspective.getCanvasImageLocation(client, graphics, localTile, (BufferedImage) jadPrayerImg, 0);
if (imageLoc != null)
{
graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null);
}
}
}
}
}
private void drawZulrahTileMinimap(Graphics2D graphics, Point startTile, ZulrahPhase phase, boolean next)
{
if (phase == null)
{
return;
}
Point zulrahLocalTile = Perspective.worldToLocal(client, phase.getZulrahTile(startTile));
Point zulrahMinimapPoint = Perspective.worldToMiniMap(client, zulrahLocalTile.getX(), zulrahLocalTile.getY());
Color color = phase.getColor();
graphics.setColor(color);
graphics.fillOval(zulrahMinimapPoint.getX(), zulrahMinimapPoint.getY(), 5, 5);
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(1));
graphics.drawOval(zulrahMinimapPoint.getX(), zulrahMinimapPoint.getY(), 5, 5);
if (next)
{
graphics.setColor(NEXT_TEXT_COLOR);
FontMetrics fm = graphics.getFontMetrics();
graphics.drawString("Next", zulrahMinimapPoint.getX() - fm.stringWidth("Next") / 2, zulrahMinimapPoint.getY() - 2);
}
}
private Polygon getCanvasTileNorthPoly(Client client, Point localLocation)
{
int plane = client.getPlane();
int halfTile = Perspective.LOCAL_TILE_SIZE / 2;
Point p1 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() - halfTile, plane);
Point p2 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() + halfTile, plane);
Point p3 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() + halfTile, plane);
if (p1 == null || p2 == null || p3 == null)
{
return null;
}
Polygon poly = new Polygon();
poly.addPoint(p1.getX(), p1.getY());
poly.addPoint(p2.getX(), p2.getY());
poly.addPoint(p3.getX(), p3.getY());
return poly;
}
private Polygon getCanvasTileSouthPoly(Client client, Point localLocation)
{
int plane = client.getPlane();
int halfTile = Perspective.LOCAL_TILE_SIZE / 2;
Point p1 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() - halfTile, plane);
Point p2 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() + halfTile, plane);
Point p3 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() - halfTile, plane);
if (p1 == null || p2 == null || p3 == null)
{
return null;
}
Polygon poly = new Polygon();
poly.addPoint(p1.getX(), p1.getY());
poly.addPoint(p2.getX(), p2.getY());
poly.addPoint(p3.getX(), p3.getY());
return poly;
}
}

View File

@@ -1,86 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.overlays;
import net.runelite.api.Client;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.ZulrahInstance;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
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.ImagePanelComponent;
import javax.annotation.Nullable;
import javax.inject.Inject;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.image.BufferedImage;
public class ZulrahPrayerOverlay extends Overlay
{
private final Client client;
private final ZulrahPlugin plugin;
@Inject
ZulrahPrayerOverlay(@Nullable Client client, ZulrahPlugin plugin)
{
setPosition(OverlayPosition.BOTTOM_RIGHT);
setPriority(OverlayPriority.MED);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
ZulrahInstance instance = plugin.getInstance();
if (instance == null)
{
return null;
}
ZulrahPhase currentPhase = instance.getPhase();
if (currentPhase == null)
{
return null;
}
Prayer prayer = currentPhase.isJad() ? null : currentPhase.getPrayer();
if (prayer == null || client.isPrayerActive(prayer))
{
return null;
}
BufferedImage prayerImage = ZulrahImageManager.getProtectionPrayerBufferedImage(prayer);
ImagePanelComponent imagePanelComponent = new ImagePanelComponent();
imagePanelComponent.setTitle("Switch!");
imagePanelComponent.setImage(prayerImage);
return imagePanelComponent.render(graphics, parent);
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.patterns;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public abstract class ZulrahPattern
{
private final List<ZulrahPhase> pattern = new ArrayList<>();
protected final void add(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, Prayer prayer)
{
add(loc, type, standLocation, false, prayer);
}
protected final void addJad(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, Prayer prayer)
{
add(loc, type, standLocation, true, prayer);
}
private void add(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, boolean jad, Prayer prayer)
{
pattern.add(new ZulrahPhase(loc, type, jad, standLocation, prayer));
}
public ZulrahPhase get(int index)
{
if (index >= pattern.size())
{
return null;
}
return pattern.get(index);
}
public boolean stageMatches(int index, ZulrahPhase instance)
{
ZulrahPhase patternInstance = get(index);
return patternInstance != null && patternInstance.equals(instance);
}
public boolean canReset(int index)
{
return index >= pattern.size();
}
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.patterns;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public class ZulrahPatternA extends ZulrahPattern
{
public ZulrahPatternA()
{
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_WEST_INSIDE, null);
add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_EAST_OUTSIDE, null);
add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.SOUTH_WEST, Prayer.PROTECT_FROM_MAGIC);
addJad(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.TOP_WEST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null);
}
@Override
public String toString()
{
return "Pattern A";
}
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.patterns;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public class ZulrahPatternB extends ZulrahPattern
{
public ZulrahPatternB()
{
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null);
add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.SOUTH_WEST, Prayer.PROTECT_FROM_MAGIC); // optional phase
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_WEST_INSIDE, null);
add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.SOUTH_EAST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.SOUTH_WEST, Prayer.PROTECT_FROM_MAGIC);
addJad(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.TOP_WEST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null);
}
@Override
public String toString()
{
return "Pattern B";
}
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.patterns;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public class ZulrahPatternC extends ZulrahPattern
{
public ZulrahPatternC()
{
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null);
add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.WEST, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.SOUTH_EAST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.PILLAR_EAST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null);
add(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC);
addJad(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, null);
}
@Override
public String toString()
{
return "Pattern C";
}
}

View File

@@ -1,56 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.patterns;
import net.runelite.api.Prayer;
import net.runelite.client.plugins.zulrah.phase.StandLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahLocation;
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
public class ZulrahPatternD extends ZulrahPattern
{
public ZulrahPatternD()
{
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null);
add(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_EAST_OUTSIDE, null);
add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.PILLAR_EAST_OUTSIDE, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null);
add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MISSILES);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC);
addJad(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC);
add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, null);
}
@Override
public String toString()
{
return "Pattern D";
}
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.phase;
public enum StandLocation
{
WEST,
EAST,
SOUTH,
SOUTH_WEST,
SOUTH_EAST,
TOP_EAST,
TOP_WEST,
PILLAR_WEST_INSIDE,
PILLAR_WEST_OUTSIDE,
PILLAR_EAST_INSIDE,
PILLAR_EAST_OUTSIDE
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.phase;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Point;
@Slf4j
public enum ZulrahLocation
{
NORTH, SOUTH, EAST, WEST;
public static ZulrahLocation valueOf(Point start, Point current)
{
int dx = start.getX() - current.getX();
int dy = start.getY() - current.getY();
if (dx == -10 && dy == 2)
{
return ZulrahLocation.EAST;
}
else if (dx == 10 && dy == 2)
{
return ZulrahLocation.WEST;
}
else if (dx == 0 && dy == 11)
{
return ZulrahLocation.SOUTH;
}
else if (dx == 0 && dy == 0)
{
return ZulrahLocation.NORTH;
}
else
{
log.debug("Unknown Zulrah location dx: {}, dy: {}", dx, dy);
return null;
}
}
}

View File

@@ -1,188 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.phase;
import net.runelite.api.NPC;
import net.runelite.api.Point;
import net.runelite.api.Prayer;
import java.awt.Color;
public class ZulrahPhase
{
private static final Color RANGE_COLOR = new Color(150, 255, 0, 100);
private static final Color MAGIC_COLOR = new Color(20, 170, 200, 100);
private static final Color MELEE_COLOR = new Color(180, 50, 20, 100);
private static final Color JAD_COLOR = new Color(255, 115, 0, 100);
private final ZulrahLocation zulrahLocation;
private final ZulrahType type;
private final boolean jad;
private final StandLocation standLocation;
private final Prayer prayer;
public ZulrahPhase(ZulrahLocation zulrahLocation, ZulrahType type, boolean jad, StandLocation standLocation, Prayer prayer)
{
this.zulrahLocation = zulrahLocation;
this.type = type;
this.jad = jad;
this.standLocation = standLocation;
this.prayer = prayer;
}
public static ZulrahPhase valueOf(NPC zulrah, Point start)
{
ZulrahLocation zulrahLocation = ZulrahLocation.valueOf(start, zulrah.getWorldLocation());
ZulrahType zulrahType = ZulrahType.valueOf(zulrah.getId());
if (zulrahLocation == null || zulrahType == null)
{
return null;
}
StandLocation standLocation = zulrahType == ZulrahType.MAGIC ? StandLocation.PILLAR_WEST_OUTSIDE : StandLocation.TOP_EAST;
Prayer prayer = zulrahType == ZulrahType.MAGIC ? Prayer.PROTECT_FROM_MAGIC : null;
return new ZulrahPhase(zulrahLocation, zulrahType, false, standLocation, prayer);
}
@Override
public String toString()
{
return "ZulrahPhase{" +
"zulrahLocation=" + zulrahLocation +
", type=" + type +
", jad=" + jad +
", standLocation=" + standLocation +
", prayer=" + prayer +
'}';
}
// world location
public Point getZulrahTile(Point startTile)
{
// NORTH doesn't need changing because it is the start
switch (zulrahLocation)
{
case SOUTH:
return new Point(startTile.getX(), startTile.getY() - 11);
case EAST:
return new Point(startTile.getX() + 10, startTile.getY() - 2);
case WEST:
return new Point(startTile.getX() - 10, startTile.getY() - 2);
}
return startTile;
}
// world location
public Point getStandTile(Point startTile)
{
switch (standLocation)
{
case WEST:
return new Point(startTile.getX() - 5, startTile.getY());
case EAST:
return new Point(startTile.getX() + 5, startTile.getY() - 2);
case SOUTH:
return new Point(startTile.getX(), startTile.getY() - 6);
case SOUTH_WEST:
return new Point(startTile.getX() - 4, startTile.getY() - 4);
case SOUTH_EAST:
return new Point(startTile.getX() + 2, startTile.getY() - 6);
case TOP_EAST:
return new Point(startTile.getX() + 6, startTile.getY() + 2);
case TOP_WEST:
return new Point(startTile.getX() - 4, startTile.getY() + 3);
case PILLAR_WEST_INSIDE:
return new Point(startTile.getX() - 4, startTile.getY() - 3);
case PILLAR_WEST_OUTSIDE:
return new Point(startTile.getX() - 5, startTile.getY() - 3);
case PILLAR_EAST_INSIDE:
return new Point(startTile.getX() + 4, startTile.getY() - 3);
case PILLAR_EAST_OUTSIDE:
return new Point(startTile.getX() + 4, startTile.getY() - 4);
}
return startTile;
}
public ZulrahLocation getZulrahLocation()
{
return zulrahLocation;
}
public ZulrahType getType()
{
return type;
}
public boolean isJad()
{
return jad;
}
public StandLocation getStandLocation()
{
return standLocation;
}
public Prayer getPrayer()
{
return prayer;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || getClass() != obj.getClass())
{
return false;
}
ZulrahPhase other = (ZulrahPhase) obj;
return this.jad == other.jad && this.zulrahLocation == other.zulrahLocation && this.type == other.type;
}
public Color getColor()
{
if (jad)
{
return JAD_COLOR;
}
else
{
switch (type)
{
case RANGE:
return RANGE_COLOR;
case MAGIC:
return MAGIC_COLOR;
case MELEE:
return MELEE_COLOR;
}
}
return RANGE_COLOR;
}
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2017, Aria <aria@ar1as.space>
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.zulrah.phase;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.NpcID;
@Slf4j
public enum ZulrahType
{
RANGE, MAGIC, MELEE;
private static final int ZULRAH_RANGE = NpcID.ZULRAH;
private static final int ZULRAH_MELEE = NpcID.ZULRAH_2043;
private static final int ZULRAH_MAGIC = NpcID.ZULRAH_2044;
public static ZulrahType valueOf(int zulrahId)
{
switch (zulrahId)
{
case ZULRAH_RANGE:
return ZulrahType.RANGE;
case ZULRAH_MELEE:
return ZulrahType.MELEE;
case ZULRAH_MAGIC:
return ZulrahType.MAGIC;
}
log.debug("Unknown Zulrah Id: {}", zulrahId);
return null;
}
}