Merge pull request #56 from sdburns1998/FightCaves
Merged both fight cave plugins
This commit is contained in:
@@ -22,14 +22,14 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.fightcavewavehelper;
|
package net.runelite.client.plugins.fightcave;
|
||||||
|
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
@ConfigGroup("Fight Cave - Wave Helper")
|
@ConfigGroup("fightcave")
|
||||||
public interface FightCaveWaveHelperConfig extends Config
|
public interface FightCaveConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "waveDisplay",
|
keyName = "waveDisplay",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.fightcavewavehelper;
|
package net.runelite.client.plugins.fightcave;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -30,12 +30,19 @@ import java.util.EnumMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.NpcID;
|
||||||
|
import net.runelite.api.events.AnimationChanged;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.api.events.NpcDespawned;
|
||||||
|
import net.runelite.api.events.NpcSpawned;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -46,13 +53,13 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Fight Cave - Waves",
|
name = "Fight Cave",
|
||||||
description = "Displays current and upcoming wave monsters in the Fight Caves",
|
description = "Displays current and upcoming wave monsters in the Fight Caves",
|
||||||
tags = {"bosses", "combat", "minigame", "overlay", "pve", "pvm", "jad", "fire", "cape", "wave"},
|
tags = {"bosses", "combat", "minigame", "overlay", "pve", "pvm", "jad", "fire", "cape", "wave"},
|
||||||
type = PluginType.PVM,
|
type = PluginType.PVM,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
public class FightCaveWaveHelperPlugin extends Plugin
|
public class FightCavePlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*");
|
private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*");
|
||||||
private static final int FIGHT_CAVE_REGION = 9551;
|
private static final int FIGHT_CAVE_REGION = 9551;
|
||||||
@@ -75,6 +82,15 @@ public class FightCaveWaveHelperPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private WaveOverlay waveOverlay;
|
private WaveOverlay waveOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private JadOverlay jadOverlay;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Nullable
|
||||||
|
private JadAttack attack;
|
||||||
|
|
||||||
|
private NPC jad;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
final WaveMonster[] waveMonsters = WaveMonster.values();
|
final WaveMonster[] waveMonsters = WaveMonster.values();
|
||||||
@@ -116,15 +132,16 @@ public class FightCaveWaveHelperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
FightCaveWaveHelperConfig provideConfig(ConfigManager configManager)
|
FightCaveConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(FightCaveWaveHelperConfig.class);
|
return configManager.getConfig(FightCaveConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startUp()
|
public void startUp()
|
||||||
{
|
{
|
||||||
overlayManager.add(waveOverlay);
|
overlayManager.add(waveOverlay);
|
||||||
|
overlayManager.add(jadOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -132,6 +149,11 @@ public class FightCaveWaveHelperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
overlayManager.remove(waveOverlay);
|
overlayManager.remove(waveOverlay);
|
||||||
currentWave = -1;
|
currentWave = -1;
|
||||||
|
|
||||||
|
overlayManager.remove(jadOverlay);
|
||||||
|
jad = null;
|
||||||
|
attack = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -172,4 +194,43 @@ public class FightCaveWaveHelperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return String.format("%dx %s", quantity, monster);
|
return String.format("%dx %s", quantity, monster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* 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 JadOverlay 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 JadOverlay(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.fightcavewavehelper;
|
package net.runelite.client.plugins.fightcave;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.fightcavewavehelper;
|
package net.runelite.client.plugins.fightcave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.fightcavewavehelper;
|
package net.runelite.client.plugins.fightcave;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@@ -43,13 +43,13 @@ class WaveOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
private static final Color HEADER_COLOR = ColorScheme.BRAND_ORANGE;
|
private static final Color HEADER_COLOR = ColorScheme.BRAND_ORANGE;
|
||||||
|
|
||||||
private final FightCaveWaveHelperConfig config;
|
private final FightCaveConfig config;
|
||||||
private final FightCaveWaveHelperPlugin plugin;
|
private final FightCavePlugin plugin;
|
||||||
|
|
||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private WaveOverlay(FightCaveWaveHelperConfig config, FightCaveWaveHelperPlugin plugin)
|
private WaveOverlay(FightCaveConfig config, FightCavePlugin plugin)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.TOP_RIGHT);
|
setPosition(OverlayPosition.TOP_RIGHT);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@@ -73,23 +73,22 @@ class WaveOverlay extends Overlay
|
|||||||
if (config.waveDisplay() == WaveDisplayMode.CURRENT
|
if (config.waveDisplay() == WaveDisplayMode.CURRENT
|
||||||
|| config.waveDisplay() == WaveDisplayMode.BOTH)
|
|| config.waveDisplay() == WaveDisplayMode.BOTH)
|
||||||
{
|
{
|
||||||
final Map<WaveMonster, Integer> waveContents = FightCaveWaveHelperPlugin.getWAVES().get(waveIndex);
|
final Map<WaveMonster, Integer> waveContents = FightCavePlugin.getWAVES().get(waveIndex);
|
||||||
|
|
||||||
addWaveInfo("Wave " + plugin.getCurrentWave(), waveContents);
|
addWaveInfo("Wave " + plugin.getCurrentWave(), waveContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config.waveDisplay() == WaveDisplayMode.NEXT
|
if ((config.waveDisplay() == WaveDisplayMode.NEXT
|
||||||
|| config.waveDisplay() == WaveDisplayMode.BOTH)
|
|| config.waveDisplay() == WaveDisplayMode.BOTH)
|
||||||
&& currentWave != FightCaveWaveHelperPlugin.MAX_WAVE)
|
&& currentWave != FightCavePlugin.MAX_WAVE)
|
||||||
{
|
{
|
||||||
final Map<WaveMonster, Integer> waveContents = FightCaveWaveHelperPlugin.getWAVES().get(waveIndex + 1);
|
final Map<WaveMonster, Integer> waveContents = FightCavePlugin.getWAVES().get(waveIndex + 1);
|
||||||
|
|
||||||
addWaveInfo("Next wave", waveContents);
|
addWaveInfo("Next wave", waveContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
return panelComponent.render(graphics);
|
return panelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWaveInfo(final String headerText, final Map<WaveMonster, Integer> waveContents)
|
private void addWaveInfo(final String headerText, final Map<WaveMonster, Integer> waveContents)
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(TitleComponent.builder()
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
@@ -114,7 +113,7 @@ class WaveOverlay extends Overlay
|
|||||||
final WaveMonster monster = monsterEntry.getKey();
|
final WaveMonster monster = monsterEntry.getKey();
|
||||||
final int quantity = monsterEntry.getValue();
|
final int quantity = monsterEntry.getValue();
|
||||||
final LineComponent line = LineComponent.builder()
|
final LineComponent line = LineComponent.builder()
|
||||||
.left(FightCaveWaveHelperPlugin.formatMonsterQuantity(monster, quantity))
|
.left(FightCavePlugin.formatMonsterQuantity(monster, quantity))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
outputLines.add(line);
|
outputLines.add(line);
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package net.runelite.client.plugins.fightcavejadhelper;
|
|
||||||
|
|
||||||
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 FightCaveJadHelperOverlay extends Overlay
|
|
||||||
{
|
|
||||||
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
|
||||||
|
|
||||||
private final Client client;
|
|
||||||
private final FightCaveJadHelperPlugin plugin;
|
|
||||||
private final SpriteManager spriteManager;
|
|
||||||
private final PanelComponent imagePanelComponent = new PanelComponent();
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FightCaveJadHelperOverlay(Client client, FightCaveJadHelperPlugin 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,91 +0,0 @@
|
|||||||
package net.runelite.client.plugins.fightcavejadhelper;
|
|
||||||
|
|
||||||
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.plugins.PluginType;
|
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
|
||||||
name = "Fight Cave - Jad",
|
|
||||||
description = "Show what to pray against Jad",
|
|
||||||
tags = {"bosses", "combat", "minigame", "overlay", "prayer", "pve", "pvm"},
|
|
||||||
type = PluginType.PVM,
|
|
||||||
enabledByDefault = false
|
|
||||||
)
|
|
||||||
public class FightCaveJadHelperPlugin extends Plugin
|
|
||||||
{
|
|
||||||
@Inject
|
|
||||||
private OverlayManager overlayManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FightCaveJadHelperOverlay 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,29 +0,0 @@
|
|||||||
package net.runelite.client.plugins.fightcavejadhelper;
|
|
||||||
|
|
||||||
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