Remove the fight cave plugin
This commit is contained in:
@@ -1,87 +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.fightcave;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import net.runelite.api.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.OverlayPriority;
|
|
||||||
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
|
||||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
|
||||||
|
|
||||||
public class FightCaveOverlay extends Overlay
|
|
||||||
{
|
|
||||||
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
|
||||||
|
|
||||||
private final Client client;
|
|
||||||
private final FightCavePlugin plugin;
|
|
||||||
private final SpriteManager spriteManager;
|
|
||||||
private final PanelComponent imagePanelComponent = new PanelComponent();
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FightCaveOverlay(Client client, FightCavePlugin plugin, SpriteManager spriteManager)
|
|
||||||
{
|
|
||||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
|
||||||
setPriority(OverlayPriority.HIGH);
|
|
||||||
this.client = client;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.spriteManager = spriteManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dimension render(Graphics2D graphics)
|
|
||||||
{
|
|
||||||
final JadAttack attack = plugin.getAttack();
|
|
||||||
|
|
||||||
if (attack == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final BufferedImage prayerImage = getPrayerImage(attack);
|
|
||||||
|
|
||||||
imagePanelComponent.getChildren().clear();
|
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
|
||||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer())
|
|
||||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
|
||||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
|
||||||
|
|
||||||
return imagePanelComponent.render(graphics);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BufferedImage getPrayerImage(JadAttack attack)
|
|
||||||
{
|
|
||||||
final int prayerSpriteID = attack == JadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES;
|
|
||||||
return spriteManager.getSprite(prayerSpriteID, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,112 +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.fightcave;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Getter;
|
|
||||||
import net.runelite.api.NPC;
|
|
||||||
import net.runelite.api.NpcID;
|
|
||||||
import net.runelite.api.events.AnimationChanged;
|
|
||||||
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.ui.overlay.OverlayManager;
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
|
||||||
name = "Fight Cave",
|
|
||||||
description = "Show what to pray against Jad",
|
|
||||||
tags = {"bosses", "combat", "minigame", "overlay", "prayer", "pve", "pvm"}
|
|
||||||
)
|
|
||||||
public class FightCavePlugin extends Plugin
|
|
||||||
{
|
|
||||||
@Inject
|
|
||||||
private OverlayManager overlayManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FightCaveOverlay overlay;
|
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
|
||||||
@Nullable
|
|
||||||
private JadAttack attack;
|
|
||||||
|
|
||||||
private NPC jad;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void startUp() throws Exception
|
|
||||||
{
|
|
||||||
overlayManager.add(overlay);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void shutDown() throws Exception
|
|
||||||
{
|
|
||||||
overlayManager.remove(overlay);
|
|
||||||
jad = null;
|
|
||||||
attack = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onNpcSpawned(final NpcSpawned event)
|
|
||||||
{
|
|
||||||
final int id = event.getNpc().getId();
|
|
||||||
|
|
||||||
if (id == NpcID.TZTOKJAD || id == NpcID.TZTOKJAD_6506)
|
|
||||||
{
|
|
||||||
jad = event.getNpc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onNpcDespawned(final NpcDespawned event)
|
|
||||||
{
|
|
||||||
if (jad == event.getNpc())
|
|
||||||
{
|
|
||||||
jad = null;
|
|
||||||
attack = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onAnimationChanged(final AnimationChanged event)
|
|
||||||
{
|
|
||||||
if (event.getActor() != jad)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jad.getAnimation() == JadAttack.MAGIC.getAnimation())
|
|
||||||
{
|
|
||||||
attack = JadAttack.MAGIC;
|
|
||||||
}
|
|
||||||
else if (jad.getAnimation() == JadAttack.RANGE.getAnimation())
|
|
||||||
{
|
|
||||||
attack = JadAttack.RANGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +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.fightcave;
|
|
||||||
|
|
||||||
import net.runelite.api.AnimationID;
|
|
||||||
import net.runelite.api.Prayer;
|
|
||||||
|
|
||||||
public enum JadAttack
|
|
||||||
{
|
|
||||||
MAGIC(AnimationID.TZTOK_JAD_MAGIC_ATTACK, Prayer.PROTECT_FROM_MAGIC),
|
|
||||||
RANGE(AnimationID.TZTOK_JAD_RANGE_ATTACK, Prayer.PROTECT_FROM_MISSILES);
|
|
||||||
|
|
||||||
private final int animation;
|
|
||||||
private final Prayer prayer;
|
|
||||||
|
|
||||||
JadAttack(int animation, Prayer prayer)
|
|
||||||
{
|
|
||||||
this.animation = animation;
|
|
||||||
this.prayer = prayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAnimation()
|
|
||||||
{
|
|
||||||
return animation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Prayer getPrayer()
|
|
||||||
{
|
|
||||||
return prayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user